1717
1818jobs :
1919
20- build-and-push-stackrox-build :
20+ build-and-push-builder-images :
2121 runs-on : ubuntu-latest
22+ strategy :
23+ matrix :
24+ image-flavor :
25+ - scanner-build
26+ - stackrox-build
27+ - stackrox-ui-test
28+ - jenkins-plugin
29+ fail-fast : false
2230 steps :
2331 - name : Checkout
2432 uses : actions/checkout@v3
2533 with :
2634 fetch-depth : 0
2735 ref : ${{ github.event.pull_request.head.sha }}
2836 - uses : ./.github/actions/build-and-push-image
37+ id : build-and-push-image
2938 with :
30- image-flavor : " stackrox-build"
31-
32- build-and-push-stackrox-test :
33- runs-on : ubuntu-latest
34- needs :
35- - build-and-push-stackrox-build
36- steps :
37- - name : Checkout
38- uses : actions/checkout@v3
39- with :
40- fetch-depth : 0
41- ref : ${{ github.event.pull_request.head.sha }}
42- - uses : ./.github/actions/build-and-push-image
43- with :
44- image-flavor : " stackrox-test"
45-
46- build-and-push-stackrox-ui-test :
47- runs-on : ubuntu-latest
48- steps :
49- - name : Checkout
50- uses : actions/checkout@v3
51- with :
52- fetch-depth : 0
53- ref : ${{ github.event.pull_request.head.sha }}
54- - uses : ./.github/actions/build-and-push-image
55- with :
56- image-flavor : " stackrox-ui-test"
57-
58- build-and-push-scanner-build :
59- runs-on : ubuntu-latest
60- steps :
61- - name : Checkout
62- uses : actions/checkout@v3
63- with :
64- fetch-depth : 0
65- ref : ${{ github.event.pull_request.head.sha }}
66- - uses : ./.github/actions/build-and-push-image
39+ image-flavor : " ${{ matrix.image-flavor }}"
40+ - name : Save image info
41+ run : |
42+ mkdir -p image-info
43+ echo "${{ steps.build-and-push-image.outputs.image-tag }}" > "image-info/${{ matrix.image-flavor }}.txt"
44+ - name : Upload image info
45+ uses : actions/upload-artifact@v4
6746 with :
68- image-flavor : " scanner-build"
47+ name : image-info-${{ matrix.image-flavor }}
48+ path : image-info/${{ matrix.image-flavor }}.txt
49+ retention-days : 1
6950
70- build-and-push-scanner-test :
51+ build-and-push-test-images :
52+ needs : build-and-push-builder-images
7153 runs-on : ubuntu-latest
72- needs :
73- - build-and-push-scanner-build
54+ strategy :
55+ matrix :
56+ image-flavor :
57+ - stackrox-test
58+ - scanner-test
59+ fail-fast : false
7460 steps :
7561 - name : Checkout
7662 uses : actions/checkout@v3
7763 with :
7864 fetch-depth : 0
7965 ref : ${{ github.event.pull_request.head.sha }}
8066 - uses : ./.github/actions/build-and-push-image
67+ id : build-and-push-image
8168 with :
82- image-flavor : " scanner-test"
83-
84- build-and-push-jenkins-plugin :
85- runs-on : ubuntu-latest
86- steps :
87- - name : Checkout
88- uses : actions/checkout@v3
89- with :
90- fetch-depth : 0
91- ref : ${{ github.event.pull_request.head.sha }}
92- - uses : ./.github/actions/build-and-push-image
69+ image-flavor : " ${{ matrix.image-flavor }}"
70+ - name : Save image info
71+ run : |
72+ mkdir -p image-info
73+ echo "${{ steps.build-and-push-image.outputs.image-tag }}" > "image-info/${{ matrix.image-flavor }}.txt"
74+ - name : Upload image info
75+ uses : actions/upload-artifact@v4
9376 with :
94- image-flavor : " jenkins-plugin"
77+ name : image-info-${{ matrix.image-flavor }}
78+ path : image-info/${{ matrix.image-flavor }}.txt
79+ retention-days : 1
9580
9681 test-cci-export :
9782 runs-on : ubuntu-latest
9883 needs :
99- - build-and-push-stackrox-test
84+ - build-and-push-builder-images
85+ - build-and-push-test-images
10086 steps :
10187 - name : Checkout
10288 uses : actions/checkout@v3
@@ -107,3 +93,44 @@ jobs:
10793 run : |
10894 docker login -u "$QUAY_RHACS_ENG_RW_USERNAME" --password-stdin <<<"$QUAY_RHACS_ENG_RW_PASSWORD" quay.io
10995 make test-cci-export
96+
97+ comment-build-images :
98+ runs-on : ubuntu-latest
99+ needs :
100+ - build-and-push-builder-images
101+ - build-and-push-test-images
102+ steps :
103+ - name : Download all image info artifacts
104+ uses : actions/download-artifact@v4
105+ with :
106+ pattern : image-info-*
107+ merge-multiple : true
108+ path : image-info
109+ - name : Build comment message
110+ id : build-message
111+ run : |
112+ echo "message<<EOF" >> $GITHUB_OUTPUT
113+ echo "## Build Images" >> $GITHUB_OUTPUT
114+ echo "" >> $GITHUB_OUTPUT
115+ echo "| Image Flavor | Image Tag |" >> $GITHUB_OUTPUT
116+ echo "|--------------|-----------|" >> $GITHUB_OUTPUT
117+ for file in image-info/*.txt; do
118+ if [ -f "$file" ]; then
119+ flavor=$(basename "$file" .txt)
120+ image=$(cat "$file")
121+ echo "| ${flavor} | \`${image}\` |" >> $GITHUB_OUTPUT
122+ fi
123+ done
124+ echo "EOF" >> $GITHUB_OUTPUT
125+ - name : Comment PR with build images
126+ if : ${{ github.event_name == 'pull_request' }}
127+ uses : thollander/actions-comment-pull-request@v3
128+ with :
129+ message : ${{ steps.build-message.outputs.message }}
130+ comment-tag : build-images
131+ - name : Print the comment message to step summary
132+ run : |
133+ # Need to cat here, because echo would interpret the backticks in the message as commands.
134+ cat >> $GITHUB_STEP_SUMMARY << 'EOF'
135+ ${{ steps.build-message.outputs.message }}
136+ EOF
0 commit comments