@@ -3,7 +3,7 @@ version: '1.0'
33stages :
44- Prepare
55- Build
6- - Push
6+ - Test
77- Deploy
88
99steps :
@@ -32,23 +32,54 @@ steps:
3232 - cf_export IMAGE_NAME=${{CF_DOCKER_REPO_URL}}/${{CF_REPO_NAME}}
3333 - cf_export IMAGE_TAG=${{CF_REVISION}}
3434
35- build_image :
36- title : Build image
35+ build :
36+ type : parallel
3737 stage : Build
38- type : build
39- description : Build app
40- image_name : ${{CF_REPO_NAME}}
41- dockerfile : Dockerfile
42- no_cache : false
43- no_cf_cache : false
38+ steps :
39+ build_image :
40+ title : Build image
41+ type : build
42+ description : Build app
43+ image_name : ${{CF_REPO_NAME}}
44+ tag : ${{CF_SHORT_REVISION}}
45+ dockerfile : Dockerfile
46+ no_cache : false
47+ no_cf_cache : false
4448
45- push_image_commit :
46- title : Push image with commit tag
47- stage : Push
48- type : push
49- candidate : ${{build_image}}
50- tags :
51- - " ${{CF_REVISION}}"
49+ build_test :
50+ title : " Build test image"
51+ type : build
52+ description : " Build test image"
53+ dockerfile : Dockerfile
54+ image_name : ${{CF_REPO_NAME}}
55+ tag : ${{CF_SHORT_REVISION}}-test
56+ when :
57+ condition :
58+ all :
59+ testsEnabled : " '${{INTEGRATION_TESTS_ENABLED}}' == 'true'"
60+
61+ test :
62+ title : " Run tests"
63+ stage : Test
64+ type : composition
65+ fail_fast : true
66+ # Run the docker-composition defined in the file
67+ composition : codefresh/test/docker-compose.yml
68+ # Run tests against the composition
69+ composition_candidates :
70+ app :
71+ image : ${{build_test}}
72+ entrypoint : /bin/sh -c
73+ command : codefresh/test/test.sh
74+ env_file :
75+ - codefresh/test/test.env
76+ volumes :
77+ - ' ${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}'
78+ working_dir : ' ${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}'
79+ when :
80+ condition :
81+ all :
82+ testsEnabled : " '${{INTEGRATION_TESTS_ENABLED}}' == 'true'"
5283
5384 set_github_deployment_status_to_pending :
5485 title : Set GitHub deployment status to "pending"
@@ -69,6 +100,14 @@ steps:
69100 all :
70101 githubNotificationsEnabled : " '${{GITHUB_NOTIFICATIONS_ENABLED}}' == 'true'"
71102
103+ push_image_commit :
104+ title : Push image with commit tag
105+ stage : Deploy
106+ type : push
107+ candidate : ${{build_image}}
108+ tags :
109+ - " ${{CF_REVISION}}"
110+
72111 deploy_helmfile :
73112 title : Deploy with helmfile
74113 stage : Deploy
@@ -103,5 +142,13 @@ steps:
103142 title : Send notification to Slack channel
104143 stage : Deploy
105144 image : cloudposse/build-harness:${{BUILD_HARNESS_VERSION}}
145+ working_directory : /build-harness
146+ environment :
147+ - GIT_COMMIT_SHORT=${{CF_SHORT_REVISION}}
148+ - GIT_COMMIT_URL=${{CF_COMMIT_URL}}
149+ - GIT_COMMIT_MESSAGE=${{CF_COMMIT_MESSAGE}}
150+ - GIT_COMMIT_AUTHOR=${{CF_COMMIT_AUTHOR}}
151+ - GIT_BRANCH_TAG=${{CF_BRANCH_TAG_NORMALIZED}}
106152 commands :
107- - make codefresh/notify/slack/deploy/webapp
153+ - make codefresh/notify/slack/deploy/webapp GIT_COMMIT_TIMESTAMP=$((${{CF_BUILD_TIMESTAMP}}/1000))
154+
0 commit comments