@@ -33,99 +33,92 @@ jobs:
3333
3434 - name : Install ansible etc
3535 run : dev/setup-env.sh
36-
37- - run : |
36+
37+ - name : Write clouds.yaml
38+ run : |
39+ echo "${CLOUDS_YAML}" > ${OS_CLIENT_CONFIG_FILE}
40+ shell : bash
41+ env :
42+ CLOUDS_YAML : ${{ secrets.CLOUDS_YAML }}
43+
44+ - name : Build OHPC image
45+ id : build
46+ run : |
47+ source venv/bin/activate
48+ ansible-playbook \
49+ -i image-build/hosts \
50+ -e @${EXTRA_VARS_FILE} \
51+ -e '{"write_cluster_image_uuid_file": true}' \
52+ image-build.yml
53+ echo "CLUSTER_IMAGE=$(cat cluster_image_uuid.txt)" >> $GITHUB_OUTPUT
54+ env :
55+ PACKER_LOG_PATH : ${{ github.workspace }}/packer-build.log
56+
57+ - name : Remove image build infra
58+ run : |
59+ source venv/bin/activate
60+ ansible-playbook \
61+ -i image-build/hosts \
62+ -e @${EXTRA_VARS_FILE} \
63+ -e cluster_state=absent \
64+ image-build.yml
65+ if : always()
66+
67+ - name : Deploy a cluster based on the new OPHC image
68+ id : deploy
69+ run : |
70+ source venv/bin/activate
71+ ansible-playbook \
72+ -i image-build/hosts \
73+ -e @${EXTRA_VARS_FILE} \
74+ -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
75+ slurm-infra.yml
76+ if : success()
77+
78+ - name : Remove cluster based on the new OHPC image
79+ run : |
80+ source venv/bin/activate
81+ ansible-playbook \
82+ -i image-build/hosts \
83+ -e @${EXTRA_VARS_FILE} \
84+ -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
85+ -e cluster_state=absent \
86+ slurm-infra.yml
87+ if : |
88+ ( failure() || cancelled() ) &&
89+ steps.build.outcome == 'success'
90+
91+ - name : Delete built image after testing
92+ run : |
3893 source venv/bin/activate
39- pip freeze
40- python -m openstack version
94+ ansible-playbook \
95+ -i image-build/hosts \
96+ -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
97+ -e '{"cluster_image_delete": true}' \
98+ image-build/image-delete-or-promote.yml
99+ if : |
100+ ( success() || failure() || cancelled() ) &&
101+ steps.build.outcome == 'success' &&
102+ github.event_name == 'pull_request'
41103
42- # - name: Write clouds.yaml
43- # run: |
44- # echo "${CLOUDS_YAML}" > ${OS_CLIENT_CONFIG_FILE}
45- # shell: bash
46- # env:
47- # CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
48- #
49- # - name: Build OHPC image
50- # id: build
51- # run: |
52- # source venv/bin/activate
53- # ansible-playbook \
54- # -i image-build/hosts \
55- # -e @${EXTRA_VARS_FILE} \
56- # -e '{"write_cluster_image_uuid_file": true}' \
57- # image-build.yml
58- # echo "CLUSTER_IMAGE=$(cat cluster_image_uuid.txt)" >> $GITHUB_OUTPUT
59- # env:
60- # PACKER_LOG_PATH: ${{ github.workspace }}/packer-build.log
61- #
62- # - name: Remove image build infra
63- # run: |
64- # source venv/bin/activate
65- # ansible-playbook \
66- # -i image-build/hosts \
67- # -e @${EXTRA_VARS_FILE} \
68- # -e cluster_state=absent \
69- # image-build.yml
70- # if: always()
71- #
72- # - name: Deploy a cluster based on the new OPHC image
73- # id: deploy
74- # run: |
75- # source venv/bin/activate
76- # ansible-playbook \
77- # -i image-build/hosts \
78- # -e @${EXTRA_VARS_FILE} \
79- # -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
80- # slurm-infra.yml
81- # if: success()
82- #
83- # - name: Remove cluster based on the new OHPC image
84- # run: |
85- # source venv/bin/activate
86- # ansible-playbook \
87- # -i image-build/hosts \
88- # -e @${EXTRA_VARS_FILE} \
89- # -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
90- # -e cluster_state=absent \
91- # slurm-infra.yml
92- # if: |
93- # ( failure() || cancelled() ) &&
94- # steps.build.outcome == 'success'
95- #
96- # - name: Delete built image after testing
97- # run: |
98- # source venv/bin/activate
99- # ansible-playbook \
100- # -i image-build/hosts \
101- # -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
102- # -e '{"cluster_image_delete": true}' \
103- # image-build/image-delete-or-promote.yml
104- # if: |
105- # ( success() || failure() || cancelled() ) &&
106- # steps.build.outcome == 'success' &&
107- # github.event_name == 'pull_request'
108- #
109- # - name: Promote built image from Private to Community after testing
110- # run: |
111- # source venv/bin/activate
112- # ansible-playbook \
113- # -i image-build/hosts \
114- # -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
115- # -e '{"cluster_image_promote_community": true}' \
116- # image-build/image-delete-or-promote.yml
117- # if: |
118- # success() &&
119- # steps.build.outcome == 'success' &&
120- # steps.deploy.outcome == 'success' &&
121- # (( github.event_name == 'workflow_dispatch' && inputs.promote_community == true )
122- # || github.event_name == 'push' )
123- #
124- # - name: Upload packer build log artifact
125- # uses: actions/upload-artifact@v3
126- # with:
127- # name: packer-build-log
128- # path: ${{ github.workspace }}/packer-build.log
129- # if: failure() || success()
130- #
131- #
104+ - name : Promote built image from Private to Community after testing
105+ run : |
106+ source venv/bin/activate
107+ ansible-playbook \
108+ -i image-build/hosts \
109+ -e cluster_image=${{ steps.build.outputs.CLUSTER_IMAGE }} \
110+ -e '{"cluster_image_promote_community": true}' \
111+ image-build/image-delete-or-promote.yml
112+ if : |
113+ success() &&
114+ steps.build.outcome == 'success' &&
115+ steps.deploy.outcome == 'success' &&
116+ (( github.event_name == 'workflow_dispatch' && inputs.promote_community == true )
117+ || github.event_name == 'push' )
118+
119+ - name : Upload packer build log artifact
120+ uses : actions/upload-artifact@v3
121+ with :
122+ name : packer-build-log
123+ path : ${{ github.workspace }}/packer-build.log
124+ if : failure() || success()
0 commit comments