Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 4b74635

Browse files
author
Jonathan Chauncey
committed
fix(build): fixing a few things in the dockerfile
also added a scripts dir to build the image in CI
1 parent f019e01 commit 4b74635

6 files changed

+250
-3
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_scripts/*

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ RUN apk --update add --virtual build-dependencies build-base openssl-dev \
1515
RUN gem update --system --no-document && \
1616
gem install --no-document json_pure && \
1717
gem install --no-document fluentd -v ${FLUENTD_VERSION} && \
18-
gem install fluent-plugin-kubernetes_metadata_filter && \
19-
gen install fluent-plugin-elasticsearch && \
20-
gem install fluent-plugin-remote_syslog && \
18+
gem install --no-document fluent-plugin-kubernetes_metadata_filter && \
19+
gem install --no-document fluent-plugin-elasticsearch && \
20+
gem install --no-document fluent-plugin-remote_syslog && \
2121
gem cleanup fluentd
2222

2323
RUN mkdir /etc/fluent

_scripts/deploy.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build and push Docker images to Docker Hub and quay.io.
4+
#
5+
6+
cd "$(dirname "$0")" || exit 1
7+
8+
export VERSION=v2-alpha
9+
echo "Logging into docker hub account!"
10+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
11+
echo "Building docker image and pushing to docker hub!"
12+
docker build -t deisci/fluentd:$VERSION ..
13+
docker push deisci/fluentd:$VERSION
14+
echo "Logging into quay.io account!"
15+
docker login -e="$QUAY_EMAIL" -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io
16+
echo "Building docker image and pushing to quay.io!"
17+
docker build -t quay.io/deisci/fluentd:$VERSION
18+
docker push quay.io/deisci/fluentd:$VERSION

_scripts/util/commit-msg

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This hook verifies that the commit message follows deis commit style
4+
# To install this hook run the following command from the deis git root
5+
# cp contrib/util/commit-msg .git/hooks/commit-msg
6+
set -eo pipefail
7+
8+
RED=$(tput setaf 1)
9+
YELLOW=$(tput setaf 3)
10+
NORMAL=$(tput sgr0)
11+
subject_regex="^(feat|fix|docs|style|ref|test|chore)\(.+\): [\w\s\d]*"
12+
capital_regex="^.+\): [a-z][\w\s\d]*"
13+
14+
MESSAGE[1]="file"
15+
16+
i=1 # the first array variable is at index 1
17+
while read line
18+
do
19+
MESSAGE[$i]=$line
20+
let i++
21+
done < "$1"
22+
23+
SUBJECT=${MESSAGE[1]}
24+
25+
if ! [[ $SUBJECT =~ $subject_regex ]]; then
26+
echo "${RED}ERROR - Invalid subject line."
27+
echo ""
28+
echo "$SUBJECT"
29+
echo ""
30+
echo "It must be in the format: {type}({scope}): {subject}"
31+
echo ""
32+
echo "The following {type}s are allowed:"
33+
echo "feat"
34+
echo "fix"
35+
echo "docs"
36+
echo "style"
37+
echo "ref"
38+
echo "test"
39+
echo "chore"
40+
echo ""
41+
echo "Read more at http://docs.deis.io/en/latest/contributing/standards/$NORMAL"
42+
exit 0
43+
fi
44+
45+
if ! [[ $SUBJECT =~ $capital_regex ]]; then
46+
echo "${RED}ERROR - Don't the capitalize commit message."
47+
echo ""
48+
echo "$SUBJECT"
49+
echo ""
50+
echo "Read more at http://docs.deis.io/en/latest/contributing/standards/$NORMAL"
51+
exit 0
52+
fi
53+
54+
if [[ ${#SUBJECT} -gt 50 ]]; then
55+
echo "${YELLOW}WARNING - Subject shouldn't be longer than 50 characters."
56+
echo ""
57+
echo "Read more at http://docs.deis.io/en/latest/contributing/standards/$NORMAL"
58+
exit 0
59+
fi
60+
61+
if [[ ${#MESSAGE[2]} -gt 0 ]]; then
62+
echo "${RED}ERROR - Second line must be blank"
63+
echo ""
64+
echo "Read more at http://docs.deis.io/en/latest/contributing/standards/$NORMAL"
65+
exit 0
66+
fi
67+
68+
cnt=${#MESSAGE[@]}
69+
for (( i = 3 ; i <= cnt ; i++ ))
70+
do
71+
if [[ ${#MESSAGE[$i]} -gt 72 ]] && [[ ${MESSAGE[$i]:0:1} != '#' ]]; then
72+
echo "${RED}ERROR on line $i - can't be longer than 72 characters."
73+
echo ""
74+
echo "Read more at http://docs.deis.io/en/latest/contributing/standards/$NORMAL"
75+
exit 0
76+
fi
77+
done
78+
79+
echo "Your commit message follows the deis commit style."
80+
81+
exit 0
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'octokit'
4+
5+
date_since = ARGV.first
6+
7+
if date_since.nil? or date_since.empty?
8+
puts "Usage: deis-contributions-since <yyyy-mm-dd>"
9+
exit 1
10+
end
11+
12+
# ignore project maintainers
13+
ignored_contributors = %w[adamreese aledbf bacongobbler carmstrong dwmcallister gabrtv helgi iancoffey jackfrancis jchauncey kalbasit kmala krancour johanneswuerbach lanej mboersma michelleN mikedup rimusz sgoings slack smothiki technosophos]
14+
15+
# make our GitHub calls here
16+
client = Octokit::Client.new(:access_token => ENV['GITHUB_ACCESS_TOKEN'])
17+
prs_obj = client.search_issues("repo:deis/deis is:pr is:merged merged:>#{date_since}", {:sort => 'updated', :order => 'desc', :per_page => 1000})
18+
issues_obj = client.search_issues("repo:deis/deis is:issue created:>#{date_since}", {:per_page => 1000})
19+
20+
contributors = {}
21+
22+
puts "-----"
23+
puts "Found #{issues_obj.items.size} issues opened on or after #{date_since}"
24+
puts "Found #{prs_obj.items.count} pull requests merged on or after #{date_since}"
25+
puts "-----"
26+
puts
27+
28+
issues_obj.items.each do |issue|
29+
author = issue.user.login.to_s
30+
title = issue.title.to_s
31+
if contributors[author].nil?
32+
contributors[author] = [title]
33+
else
34+
contributors[author].push(title)
35+
end
36+
end
37+
38+
prs_obj.items.each do |pr|
39+
author = pr.user.login.to_s
40+
title = pr.title.to_s
41+
if contributors[author].nil?
42+
contributors[author] = [title]
43+
else
44+
contributors[author].push(title)
45+
end
46+
puts "- #{pr.title} - [\##{pr.number}](#{pr.pull_request.html_url}) ([@#{pr.user.login}](#{pr.user.html_url}))"
47+
end
48+
puts
49+
50+
# remove project maintainers from the list of contributors
51+
contributors.reject! {|k,v| ignored_contributors.include?(k) }
52+
53+
puts '## Community Shout-Outs'
54+
puts
55+
puts 'We want to thank the following Deis community members for creating GitHub issues, providing support to others, and working on various Deis branches:'
56+
puts
57+
contributors.sort_by {|k,v| k.downcase}.map do |author, titles|
58+
puts "- @#{author}: #{titles.join(", ")}"
59+
end
60+
puts
61+
puts "The Deis community continues to grow, and Deis wouldn't be here without you! If we slighted your contribution to this release, please let us know so we can update."
62+
puts

_scripts/util/generate-changelog.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
# vim: et tw=0 sw=4 ts=4
3+
4+
usage() {
5+
echo "Usage: $0 <from> [to]"
6+
echo "The REPOROOT and TYPES variables may be used to customize"
7+
echo "what is scraped from the commit logs. Current settings are:"
8+
echo
9+
echo " REPOROOT = $REPOROOT"
10+
echo " TYPES = $TYPES"
11+
echo
12+
}
13+
14+
# Print the information scraped from git
15+
retrieve() {
16+
while read commit hash message
17+
do
18+
# Extract the subsystem where type(subsystem): message
19+
SUBSYSTEM=$(echo $message | cut -d'(' -f2 | cut -d')' -f1 | sed 's/\*/\(all\)/g')
20+
# Extract the message where type(subsystem): message
21+
MESSAGE=$(echo $message | awk -F ")" '{ print $2}' | sed 's/://' | cut -f2- -d' ')
22+
# Generate a link to the full legal commit on GitHub
23+
LINK="$REPOROOT/commit/$hash"
24+
# Echo all this in a way that makes the commit hash and message a link
25+
# to the commit in markdown
26+
echo ' -' "[\`$commit\`]($LINK)" "$SUBSYSTEM": "$MESSAGE"
27+
done < <(git --no-pager log --oneline --merges --oneline --format="%h %H %b" --grep="$1" "$FROM".."$TO")
28+
# Scrape the information from git
29+
}
30+
31+
# Wrap feature type and show its relevant commits
32+
subheading() {
33+
echo "#### $1"
34+
echo
35+
retrieve "$2"
36+
echo
37+
}
38+
39+
main() {
40+
# if REPOROOT is already in the environment, don't overload it and use that
41+
if [ -z "$REPOROOT" ];
42+
then
43+
REPOROOT="https://github.com/deis/deis"
44+
fi
45+
46+
# if TYPES is already in the environment, don't overload it and use that
47+
if [ -z "$TYPES" ];
48+
then
49+
# Based on https://github.com/deis/deis/blob/master/CONTRIBUTING.md
50+
# The format is in the form of $shortname;$longname $shortname;longname.
51+
TYPES="feat(;Features fix(;Fixes docs(;Documentation chore(;Maintenance"
52+
fi
53+
54+
# Print usage summary if user didn't specify a beginning
55+
if [ -z "$1" ];
56+
then
57+
usage
58+
exit 1
59+
fi
60+
61+
FROM=$1
62+
TO=${2:-"HEAD"}
63+
64+
printf "### $FROM -> $TO\n\n"
65+
66+
# Iterate over the types of messages specified
67+
for LEGALTYPE in $TYPES
68+
do
69+
SHORT=$(echo "$LEGALTYPE" | cut -f1 -d';')
70+
LONG=$(echo "$LEGALTYPE" | cut -f2 -d';')
71+
72+
subheading $LONG $SHORT
73+
done
74+
}
75+
76+
if (( $SHLVL == 2 ))
77+
then
78+
# If this is being run as a command
79+
main $*
80+
exit
81+
else
82+
# Otherwise this is being sourced
83+
unset -f main
84+
unset -f usage
85+
fi

0 commit comments

Comments
 (0)