Skip to content

Commit

Permalink
Release 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rockb1017 committed Feb 21, 2020
2 parents 6a3e95d + 952b25b commit 754ac9f
Show file tree
Hide file tree
Showing 18 changed files with 434 additions and 94 deletions.
3 changes: 2 additions & 1 deletion .circleci/build_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ aws ecr get-login --region $AWS_REGION --no-include-email | bash
echo "Building docker image..."
cp /tmp/pkg/fluent-plugin-kubernetes-objects-*.gem docker
echo "Copy latest fluent-plugin-splunk-hec gem from S3"
docker build --build-arg VERSION=$VERSION --build-arg FLUENT_SPLUNK_HEC_GEM_VERSION=$FLUENT_SPLUNK_HEC_GEM_VERSION --no-cache -t splunk/fluent-plugin-kubernetes-objects:ci ./docker
VERSION=`cat VERSION`
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-kubernetes-objects:ci ./docker
docker tag splunk/fluent-plugin-kubernetes-objects:ci $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-objects:latest
echo "Push docker image to ecr..."
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-objects:latest | awk 'END{print}'
Expand Down
7 changes: 6 additions & 1 deletion .circleci/build_and_push_to_dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ set -e
echo "Building docker image..."
cp /tmp/pkg/fluent-plugin-kubernetes-objects-*.gem docker
VERSION=`cat VERSION`
docker build --build-arg VERSION=$VERSION --build-arg FLUENT_SPLUNK_HEC_GEM_VERSION=$FLUENT_SPLUNK_HEC_GEM_VERSION --no-cache -t splunk/fluent-plugin-kubernetes-objects:ci ./docker
echo "Copying licenses to be included in the docker image..."
mkdir docker/licenses
cp -rp LICENSE docker/licenses/
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-kubernetes-objects:ci ./docker
docker tag splunk/fluent-plugin-kubernetes-objects:ci splunk/${DOCKERHUB_REPO_NAME}:${VERSION}
docker tag splunk/fluent-plugin-kubernetes-objects:ci splunk/${DOCKERHUB_REPO_NAME}:latest
echo "Push docker image to splunk dockerhub..."
docker login --username=$DOCKERHUB_ACCOUNT_ID --password=$DOCKERHUB_ACCOUNT_PASS
docker push splunk/${DOCKERHUB_REPO_NAME}:${VERSION} | awk 'END{print}'
docker push splunk/${DOCKERHUB_REPO_NAME}:latest | awk 'END{print}'
echo "Docker image pushed successfully to docker-hub."
26 changes: 26 additions & 0 deletions .circleci/check_version_trigger_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e

#!/usr/bin/env bash
LATEST_COMMIT=$(git rev-parse HEAD)
VERSION_COMMIT=$(git log -1 --format=format:%H VERSION)
if [ $VERSION_COMMIT = $LATEST_COMMIT ];
then
if [ -s VERSION ] # Check if content is empty
then
VERSION=`cat VERSION`
echo "VERSION is changed to $VERSION"
else
echo "[ERROR] VERSION file is empty."
exit 1
fi
git config user.email "splunk-oss-admin@splunk.com"
git config user.name "splunk-oss-admin"
git checkout develop
git pull origin develop
git checkout -b release/$VERSION origin/develop
git push https://$RELEASE_GITHUB_USER:$RELEASE_GITHUB_PASS@github.com/splunk/fluent-plugin-kubernetes-objects.git release/$VERSION
git checkout master
git merge --no-edit release/$VERSION
git push https://$RELEASE_GITHUB_USER:$RELEASE_GITHUB_PASS@github.com/splunk/fluent-plugin-kubernetes-objects.git master
fi
86 changes: 69 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
root: /tmp
paths:
- pkg
test:
unit_test:
docker:
- image: circleci/ruby:2.6.1-node-browsers
working_directory: ~/repo
Expand All @@ -38,23 +38,33 @@ jobs:
- run:
name: Run unit tests
command: |
rake test -t -v
push:
bundle exec rake test -t -v
func_test_master:
docker:
- image: circleci/ruby:2.6.1-node-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: /tmp
- checkout
- setup_remote_docker:
reusable: true
- run:
name: Build and push docker image to ecr
name: trigger
command: |
.circleci/build_and_push.sh
.circleci/trigger_func_test.sh master
func_test_develop:
docker:
- image: circleci/ruby:2.6.1-node-browsers
working_directory: ~/repo
steps:
- checkout
- setup_remote_docker:
reusable: true
- run:
name: trigger
command: |
.circleci/trigger_func_test.sh develop
release:
docker:
- image: circleci/ruby:2.6.1-node-browsers
Expand All @@ -77,25 +87,67 @@ jobs:
name: Upload gem to Github
command: |
.circleci/build_and_push_to_github_release.sh
- run:
name: Upload gem to rubygems
command: |
.circleci/push_gem_to_rubygems.sh
check_version:
docker:
- image: circleci/ruby:2.6.1-node-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: /tmp
- checkout
- setup_remote_docker:
reusable: true
- run:
name: Check VERSION file for change
command: |
.circleci/check_version_trigger_release.sh
workflows:
version: 2
build_test_push:
build_test:
jobs:
- build
- test:
- build:
filters:
branches:
ignore:
- /^release\/.*/
- master
- unit_test:
requires:
- build
- push:
# - func_test_master:
# requires:
# - unit_test
# - func_test_develop:
# requires:
# - unit_test
- check_version:
requires:
- test
- unit_test
# - func_test_develop
filters:
branches:
only: develop
- release:
requires:
- test
release:
jobs:
- build:
filters:
branches:
only: master
- unit_test:
requires:
- build
# - func_test_master:
# requires:
# - unit_test
# - func_test_develop:
# requires:
# - unit_test
- release:
requires:
- unit_test
# - func_test_develop
2 changes: 2 additions & 0 deletions .circleci/gem_credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
:rubygems_api_key: __RUBYGEMS_API_KEY__
1 change: 1 addition & 0 deletions .circleci/push_gem.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -e
sudo apt-get update
sudo apt-get install -y python-pip libpython-dev > /dev/null 2>&1
echo "Installing aws cli..."
sudo pip install awscli > /dev/null 2>&1
Expand Down
7 changes: 7 additions & 0 deletions .circleci/push_gem_to_rubygems.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
echo "Pushing object gem to rubygems.org..."
echo "gem `gem --version`"
cat .circleci/gem_credentials | sed -e "s/__RUBYGEMS_API_KEY__/${RUBYGEMS_API_KEY}/" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
gem push /tmp/pkg/fluent-plugin-kubernetes-objects-*.gem
41 changes: 41 additions & 0 deletions .circleci/trigger_func_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

# trigger SCK 'master' branch to introduce this new image from this commit
# to working version of every other component.
ORGANIZATION=splunk
PROJECT=splunk-connect-for-kubernetes
BRANCH=$1

# Trigger functional test
curl -X POST --header "Content-Type: application/json" \
-d '{"build_parameters": {"CIRCLE_JOB":"build_test", "TRIG_BRANCH":"'"$CIRCLE_BRANCH"'", "TRIG_PROJECT":"'"$CIRCLE_PROJECT_REPONAME"'", "TRIG_REPO":"'"$CIRCLE_REPOSITORY_URL"'"}}' "https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/tree/$BRANCH?circle-token=$CIRCLE_TOKEN" > build.json
cat build.json
BUILD_NUM=$(jq -r .build_num build.json)

# Wait until finish or maximum 20 minutes
TIMEOUT=20
DONE="FALSE"
until [ "$TIMEOUT" -lt 0 ] || [ "$DONE" == "TRUE" ]; do
curl -s https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/$BUILD_NUM?circle-token=$CIRCLE_TOKEN > build_progress.json
STATUS=$(jq -r .status build_progress.json)
echo "STATUS = $STATUS"
if [ "$STATUS" != "running" ] && [ "$STATUS" != "queued" ]; then
DONE="TRUE"
else
let TIMEOUT--
sleep 60
fi
done

BUILD_URL=$(jq -r .build_url build_progress.json)
if [ "$DONE" == "FALSE" ]; then
# Cancel hanging job and fail
curl -X POST https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/$BUILD_NUM/cancel?circle-token=$CIRCLE_TOKEN
else
if [ "$STATUS" != "success" ] && [ "$STATUS" != "fixed" ]; then
echo "Functional test have failed please see:"
echo $BUILD_URL
exit 1
fi
exit 0
fi
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
*.gem
.DS_Store
*.aes
docker/licenses/
docker/gem/
docker/gems/
docker/.bundle/
65 changes: 36 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,64 +1,72 @@
PATH
remote: .
specs:
fluent-plugin-kubernetes-objects (1.1.1)
fluentd (~> 1.4)
kubeclient (~> 4.2)
fluent-plugin-kubernetes-objects (1.1.3)
fluentd (~> 1.9.1)
http_parser.rb (= 0.5.3)
kubeclient (~> 4.6.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
cool.io (1.5.3)
concurrent-ruby (1.1.6)
cool.io (1.6.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
dig_rb (1.0.1)
docile (1.3.1)
domain_name (0.5.20180417)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
fluentd (1.4.1)
ffi (1.12.2)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fluentd (1.9.2)
cool.io (>= 1.4.5, < 2.0.0)
dig_rb (~> 1.0.0)
http_parser.rb (>= 0.5.1, < 0.7.0)
msgpack (>= 0.7.0, < 2.0.0)
msgpack (>= 1.3.1, < 2.0.0)
serverengine (>= 2.0.4, < 3.0.0)
sigdump (~> 0.2.2)
strptime (>= 0.2.2, < 1.0.0)
tzinfo (~> 1.0)
tzinfo (>= 1.0, < 3.0)
tzinfo-data (~> 1.0)
yajl-ruby (~> 1.0)
hashdiff (0.3.8)
http (3.3.0)
http (4.3.0)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.1.1)
http_parser.rb (0.6.0)
http-form_data (2.2.0)
http-parser (1.2.1)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.5.3)
json (2.1.0)
kubeclient (4.3.0)
http (~> 3.0)
kubeclient (4.6.0)
http (>= 3.0, < 5.0)
recursive-open-struct (~> 1.0, >= 1.0.4)
rest-client (~> 2.0)
mime-types (3.2.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mime-types-data (3.2019.1009)
minitest (5.11.3)
msgpack (1.2.9)
msgpack (1.3.3)
netrc (0.11.0)
power_assert (1.1.3)
public_suffix (3.0.3)
rake (12.3.2)
recursive-open-struct (1.1.0)
rest-client (2.0.2)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
safe_yaml (1.0.4)
serverengine (2.1.0)
serverengine (2.2.1)
sigdump (~> 0.2.2)
sigdump (0.2.4)
simplecov (0.16.1)
Expand All @@ -69,14 +77,13 @@ GEM
strptime (0.2.3)
test-unit (3.3.0)
power_assert
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2019.1)
tzinfo (2.0.1)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2019.3)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unf_ext (0.0.7.6)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand All @@ -90,10 +97,10 @@ DEPENDENCIES
bundler (~> 2.0)
fluent-plugin-kubernetes-objects!
minitest (~> 5.11)
rake (~> 12.3)
rake (~> 12.0)
simplecov
test-unit (~> 3.3)
webmock (~> 3.5)

BUNDLED WITH
2.0.1
2.1.4
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.2
1.1.3
Loading

0 comments on commit 754ac9f

Please sign in to comment.