77 workflow_dispatch :
88
99env :
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"
1212
1313jobs :
1414 generate-jobs :
@@ -47,20 +47,14 @@ jobs:
4747 env :
4848 TAGS : ${{ toJson(matrix.tags) }}
4949 run : |
50- # Set a default image
51- echo "BASE_IMAGE=${IMAGE_STAGING}" >> $GITHUB_ENV
52-
5350 RESULT=""
5451 for tag in $(jq -r '.[]' <<< "${TAGS}")
5552 do
56- RESULT="${RESULT},ghcr.io/ ${IMAGE_STAGING}:${tag}"
53+ RESULT="${RESULT},${IMAGE_STAGING}:${tag}"
5754 # If we are running the pipeline in the main branch images are pushed in both -testing and PROD repo
5855 if [ "${GITHUB_REF#refs/heads/}" == main ]
5956 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}"
6458 fi
6559 done
6660 echo "TAGS=${RESULT%,}" >> $GITHUB_ENV
8781 - name : Dockle scan
8882 uses : erzz/dockle-action@v1
8983 with :
90- image : " ghcr.io/ ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
84+ image : " ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
9185 exit-code : ' 1'
9286 failure-threshold : WARN
9387 accept-keywords : key
9993 env :
10094 SNYK_TOKEN : ${{ secrets.SNYK_TOKEN }}
10195 with :
102- image : " ghcr.io/ ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
96+ image : " ${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
10397 args : --severity-threshold=high --file=${{ matrix.file }}
10498
10599 - name : Upload result to GitHub Code Scanning
@@ -120,7 +114,15 @@ jobs:
120114
121115 - name : Create artifact
122116 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 }} \
124126 MAJOR=${{ matrix.version }} \
125127 yq --null-input '{
126128 "apiVersion": "postgresql.cnpg.io/v1",
0 commit comments