2018-12-19 17:13:51 +00:00
|
|
|
workflows:
|
2021-07-20 12:04:38 +00:00
|
|
|
version: 2.1
|
2018-12-19 17:13:51 +00:00
|
|
|
build_test_deploy:
|
|
|
|
jobs:
|
|
|
|
- test
|
|
|
|
- publish_latest:
|
|
|
|
context: docker-hub
|
|
|
|
requires:
|
|
|
|
- test
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
2021-07-20 12:04:38 +00:00
|
|
|
- build_children:
|
|
|
|
context: circle-api
|
|
|
|
requires:
|
|
|
|
- publish_latest
|
2018-12-19 17:13:51 +00:00
|
|
|
|
2021-07-20 12:04:38 +00:00
|
|
|
version: 2.1
|
|
|
|
executors:
|
|
|
|
testbuild-executor:
|
|
|
|
machine:
|
|
|
|
image: ubuntu-1604:201903-01
|
2018-12-19 17:13:51 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
2021-07-20 12:04:38 +00:00
|
|
|
executor: testbuild-executor
|
2018-12-19 17:13:51 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Install goss
|
|
|
|
command: |
|
|
|
|
# rather than give internet scripts SU rights, we install to local user bin and add to path
|
2021-07-20 12:04:38 +00:00
|
|
|
[ -d ~/bin ] || mkdir ~/bin
|
2018-12-19 17:13:51 +00:00
|
|
|
export GOSS_DST=~/bin
|
|
|
|
export PATH=$PATH:~/bin
|
|
|
|
curl -fsSL https://goss.rocks/install | sh
|
|
|
|
goss -version
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: |
|
|
|
|
# Don't forget path!
|
|
|
|
export PATH=$PATH:~/bin
|
2021-07-20 12:04:38 +00:00
|
|
|
./run-tests.sh --circleci --keepimage
|
2018-12-19 17:13:51 +00:00
|
|
|
- run:
|
|
|
|
name: Save docker image
|
|
|
|
command: |
|
2021-07-20 12:04:38 +00:00
|
|
|
[ -d workspace ] || mkdir workspace
|
2019-05-30 20:30:25 +00:00
|
|
|
docker save -o workspace/lancachenet-monolithic.tar lancachenet/monolithic:goss-test
|
2021-07-20 12:04:38 +00:00
|
|
|
#Download from Artifacts and Load this into your own docker using the following command
|
|
|
|
#docker load -i /tmp/workspace/lancachenet-monolithic.tar
|
2018-12-19 17:13:51 +00:00
|
|
|
- store_test_results:
|
2021-07-20 12:04:38 +00:00
|
|
|
path: reports/goss/report.xml
|
2018-12-19 17:13:51 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: reports
|
|
|
|
destination: reports
|
2020-02-11 15:32:09 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: workspace/lancachenet-monolithic.tar
|
|
|
|
destination: docker-lancachenet-monolithic.tar
|
2021-07-20 12:04:38 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: workspace
|
|
|
|
paths:
|
|
|
|
lancachenet-monolithic.tar
|
2018-12-19 17:13:51 +00:00
|
|
|
publish_latest:
|
2021-07-20 12:04:38 +00:00
|
|
|
executor: testbuild-executor
|
2018-12-19 17:13:51 +00:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp/workspace
|
|
|
|
- run:
|
|
|
|
name: "Deploy latest to docker hub"
|
|
|
|
command: |
|
2019-05-30 20:30:25 +00:00
|
|
|
docker load -i /tmp/workspace/lancachenet-monolithic.tar
|
2021-07-20 12:04:38 +00:00
|
|
|
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
2019-05-30 20:30:25 +00:00
|
|
|
docker tag lancachenet/monolithic:goss-test lancachenet/monolithic:latest
|
|
|
|
docker push lancachenet/monolithic:latest
|
2021-07-20 12:04:38 +00:00
|
|
|
build_children:
|
|
|
|
executor: testbuild-executor
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: "Request API to build children"
|
|
|
|
command: |
|
|
|
|
for child in {"monolithic"}; do
|
|
|
|
echo "Asking API to trigger build for $child"
|
|
|
|
curl -X POST --header "Content-Type: application/json" -d '{"branch":"master"}' https://circleci.com/api/v1.1/project/github/lancachenet/$child/build?circle-token=${CIRCLE_API_USER_TOKEN}
|
|
|
|
done
|