Skip to content

Commit

Permalink
Release to master with stable CI (#4)
Browse files Browse the repository at this point in the history
Improve CI process by waiting for container ready
  • Loading branch information
Ryan Faircloth authored and GitHub committed Jun 30, 2019
1 parent 2973ad5 commit 3465306
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 769 deletions.
243 changes: 146 additions & 97 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,150 @@
version: 2
jobs:
build:
environment:
IMAGE_NAME: rfaircloth/scs
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init --recursive
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Build Docker image
command: pushd package; docker build -f Dockerfile --build-arg RH_ORG=$RH_ORG --build-arg RH_ACTIVATION=$RH_ACTIVATION -t $IMAGE_NAME:build .
- run:
name: Tag Docker image
command: docker tag $IMAGE_NAME:build $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Push Docker image
command: docker push $IMAGE_NAME:$CIRCLE_SHA1
dgoss:
environment:
IMAGE_NAME: rfaircloth/scs
GOSS_VER: v0.3.7
GOSS_OPTS: "--max-concurrent=1 --format junit"
GOSS_FILES_STRATEGY: cp
version: 2.1
jobs:
build:
environment:
IMAGE_NAME: rfaircloth/scs
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init --recursive
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Build Docker image
command: pushd package; docker build -f Dockerfile --build-arg RH_ORG=$RH_ORG --build-arg RH_ACTIVATION=$RH_ACTIVATION -t $IMAGE_NAME:build .
- run:
name: Tag Docker image
command: docker tag $IMAGE_NAME:build $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Push Docker image
command: docker push $IMAGE_NAME:$CIRCLE_SHA1
dgoss:
environment:
IMAGE_NAME: rfaircloth/scs
GOSS_VER: v0.3.7
GOSS_OPTS: "--max-concurrent=1 --format junit"
GOSS_FILES_STRATEGY: cp

docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Docker pull
command: docker pull $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Install goss
command: |
# rather than give internet scripts SU rights, we install to local user bin and add to path
curl -fsSL https://goss.rocks/install | GOSS_VER=v0.3.7 sudo sh
goss -version
- run:
name: Test Docker
command: |
mkdir -p ~/project/test-results
# Don't forget path!
export PATH=$PATH:~/bin
pushd package
GOSS_FMT_OPTIONS="perfdata verbose" GOSS_FILES_STRATEGY=cp GOSS_OPTS="--max-concurrent=1 --format junit" dgoss run -t $IMAGE_NAME:$CIRCLE_SHA1 3>&1 1>&2 2>&3 > /tmp/goss.tmp || true ; cat /tmp/goss.tmp | grep -v "<"
popd
cat /tmp/goss.tmp | grep "[<\>]" > ~/project/test-results/goss.xml
- store_test_results:
path: test-results
publish:
environment:
IMAGE_NAME: rfaircloth/scs
docker:
- image: circleci/buildpack-deps:stretch
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Docker pull
command: docker pull $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Docker tag image
command: docker tag $IMAGE_NAME:$CIRCLE_SHA1 $IMAGE_NAME:$CIRCLE_BRANCH
- run:
name: Docker push tag
command: docker push $IMAGE_NAME:$CIRCLE_BRANCH
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Docker pull
command: docker pull $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Install goss
command: |
# rather than give internet scripts SU rights, we install to local user bin and add to path
curl -fsSL https://goss.rocks/install | GOSS_VER=v0.3.7 sudo sh
goss -version
- run:
name: Test Docker
command: |
mkdir -p ~/project/test-results
# Don't forget path!
export PATH=$PATH:~/bin
pushd package
GOSS_FMT_OPTIONS="perfdata verbose" GOSS_FILES_STRATEGY=cp GOSS_OPTS="--max-concurrent=1 --format junit" dgoss run -t $IMAGE_NAME:$CIRCLE_SHA1 3>&1 1>&2 2>&3 > /tmp/goss.tmp || true ; cat /tmp/goss.tmp | grep -v "<"
popd
cat /tmp/goss.tmp | grep "[<\>]" > ~/project/test-results/goss.xml
- store_test_results:
path: test-results
test-unit:
docker:
- image: circleci/buildpack-deps:stretch
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run: git submodule sync
- run: git submodule update --init --recursive
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Docker pull
command: docker-compose pull
- run:
name: Setup test volume
command: |
mkdir test-results
docker volume create sc4s-tests
docker volume create sc4s-results
docker container create --name dummy \
-v sc4s-tests:/work/tests \
-v sc4s-results:/work/test-results \
registry.access.redhat.com/ubi7/ubi
docker cp tests/ dummy:/work/tests/
docker rm dummy
- run:
name: Docker Compose build
command: |
docker-compose build \
--build-arg RH_ACTIVATION=$RH_ACTIVATION \
--build-arg RH_ORG=$RH_ORG
- run:
name: Docker Compose up
command: docker-compose up --abort-on-container-exit
- run:
name: Collect test results from Docker Compose
command: |
docker container create --name dummy \
-v sc4s-tests:/work/tests \
-v sc4s-results:/work/test-results \
registry.access.redhat.com/ubi7/ubi
docker cp dummy:/work/test-results/functional test-results
docker rm dummy
when: always
- store_test_results:
path: test-results
publish:
environment:
IMAGE_NAME: rfaircloth/scs
docker:
- image: circleci/buildpack-deps:stretch
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker Login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Docker pull
command: docker pull $IMAGE_NAME:$CIRCLE_SHA1
- run:
name: Docker tag image
command: docker tag $IMAGE_NAME:$CIRCLE_SHA1 $IMAGE_NAME:$CIRCLE_BRANCH
- run:
name: Docker push tag
command: docker push $IMAGE_NAME:$CIRCLE_BRANCH

workflows:
version: 2
build-publish:
jobs:
- build
- dgoss:
requires:
- build
- publish:
requires:
- dgoss
filters:
branches:
only:
- master
- develop
workflows:
build-publish:
jobs:
- build
- dgoss:
requires:
- build
- test-unit
- publish:
requires:
- dgoss
- test-unit
filters:
branches:
only:
- master
- develop
10 changes: 10 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RH_ORG=xxxx
RH_ACTIVATION=xxxxx
SPLUNK_HEC_TOKEN=a778f63a-5dff-4e3c-a72c-a03183659e94
SPLUNK_PASSWORD=Changed@11
SPLUNK_START_ARGS=--accept-license
SPLUNK_HEC_URL=https://splunk:8088/services/collector/event
SPLUNK_HEC_STATSURL=https://splunk:8088/services/collector/event
SPLUNK_CONNECT_METHOD=hec
SPLUNK_DEFAULT_INDEX=main
SPLUNK_METRICS_INDEX=metrics
13 changes: 3 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ dmypy.json
*.bak
*.gho
*.ori
*.orig
*.tmp

### Windows template
Expand Down Expand Up @@ -202,7 +201,6 @@ export_presets.cfg
*.bz2
*.xz
*.lzma
*.cab

# Packing-only formats
*.iso
Expand All @@ -212,15 +210,10 @@ export_presets.cfg
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
*.msi
*.msm
*.msp

### Patch template
*.orig
*.rej

### macOS template
Expand Down Expand Up @@ -256,7 +249,6 @@ Temporary Items
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
Expand All @@ -271,15 +263,13 @@ Temporary Items
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json

### PuTTY template
Expand All @@ -305,3 +295,6 @@ tags
# Persistent undo
[._]*.un~

/test-results
/.idea/workspace.xml
/.idea/tasks.xml
5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/sc4s.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions .idea/vcs.xml

This file was deleted.

Loading

0 comments on commit 3465306

Please sign in to comment.