7
7
workflow_dispatch :
8
8
9
9
env :
10
- IMAGE_STAGING : cloudnative-pg/ postgresql-testing
11
- IMAGE_RELEASE : cloudnative-pg/ postgresql
10
+ IMAGE_STAGING : " ghcr.io/${{ github.repository_owner }}/ postgresql-testing"
11
+ IMAGE_RELEASE : " ghcr.io/${{ github.repository_owner }}/ postgresql"
12
12
13
13
jobs :
14
14
generate-jobs :
@@ -47,20 +47,14 @@ jobs:
47
47
env :
48
48
TAGS : ${{ toJson(matrix.tags) }}
49
49
run : |
50
- # Set a default image
51
- echo "BASE_IMAGE=${IMAGE_STAGING}" >> $GITHUB_ENV
52
-
53
50
RESULT=""
54
51
for tag in $(jq -r '.[]' <<< "${TAGS}")
55
52
do
56
- RESULT="${RESULT},ghcr.io/ ${IMAGE_STAGING}:${tag}"
53
+ RESULT="${RESULT},${IMAGE_STAGING}:${tag}"
57
54
# If we are running the pipeline in the main branch images are pushed in both -testing and PROD repo
58
55
if [ "${GITHUB_REF#refs/heads/}" == main ]
59
56
then
60
- # Set prod as default image
61
- echo "BASE_IMAGE=${IMAGE_RELEASE}" >> $GITHUB_ENV
62
-
63
- RESULT="${RESULT},ghcr.io/${IMAGE_RELEASE}:${tag}"
57
+ RESULT="${RESULT},${IMAGE_RELEASE}:${tag}"
64
58
fi
65
59
done
66
60
echo "TAGS=${RESULT%,}" >> $GITHUB_ENV
87
81
- name : Dockle scan
88
82
uses : erzz/dockle-action@v1
89
83
with :
90
- image : " ghcr.io/ ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
84
+ image : " ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
91
85
exit-code : ' 1'
92
86
failure-threshold : WARN
93
87
accept-keywords : key
99
93
env :
100
94
SNYK_TOKEN : ${{ secrets.SNYK_TOKEN }}
101
95
with :
102
- image : " ghcr.io/ ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
96
+ image : " ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
103
97
args : --severity-threshold=high --file=${{ matrix.file }}
104
98
105
99
- name : Upload result to GitHub Code Scanning
@@ -120,7 +114,15 @@ jobs:
120
114
121
115
- name : Create artifact
122
116
run : |
123
- DIGEST=ghcr.io/${{ env.BASE_IMAGE }}@${{ steps.build.outputs.digest }} \
117
+ # Set a default image
118
+ echo "BASE_IMAGE=${IMAGE_STAGING}" >> $GITHUB_ENV
119
+ if [ "${GITHUB_REF#refs/heads/}" == main ]; then
120
+ # Set prod as default image
121
+ echo "BASE_IMAGE=${IMAGE_RELEASE}" >> $GITHUB_ENV
122
+ fi
123
+ echo BASE_IMAGE=${BASE_IMAGE} >> $GITHUB_ENV
124
+
125
+ DIGEST=${{ env.BASE_IMAGE }}@${{ steps.build.outputs.digest }} \
124
126
MAJOR=${{ matrix.version }} \
125
127
yq --null-input '{
126
128
"apiVersion": "postgresql.cnpg.io/v1",
0 commit comments