|
42 | 42 | with: |
43 | 43 | fetch-depth: 1 |
44 | 44 |
|
45 | | -# - name: Set up Docker Buildx |
46 | | -# uses: docker/setup-buildx-action@v3 |
47 | | -# |
48 | | -# - name: Build and push Docker image to ghcr.io |
49 | | -# id: docker_build |
50 | | -# uses: docker/build-push-action@v6 |
51 | | -# with: |
52 | | -# context: . |
53 | | -# no-cache: true |
54 | | -# push: true |
55 | | -# tags: ${{ env.IMAGE_NAME }} |
56 | | -# build-args: | |
57 | | -# COMMIT_SHA: ${{ github.sha }} |
58 | | - |
59 | 45 | - name: Build docker image |
60 | 46 | run: |
61 | 47 | make image |
|
81 | 67 | path: ${{ env.IMAGE_TAR_FILENAME }} |
82 | 68 | key: ${{ env.IMAGE_NAME }} |
83 | 69 |
|
84 | | -# - name: Sanitize digest |
85 | | -# id: sanitize-digest |
86 | | -# run: | |
87 | | -# DIGEST=$(echo "${{ steps.docker_build.outputs.digest }}" | sed 's/^sha256://') |
88 | | -# echo "digest=${DIGEST}" >> ${GITHUB_OUTPUT} |
89 | | - |
90 | 70 | - name: Setup Kosli CLI |
91 | 71 | uses: kosli-dev/setup-cli-action@v2 |
92 | 72 | with: |
@@ -131,49 +111,49 @@ jobs: |
131 | 111 | make snyk-container-scan |
132 | 112 |
|
133 | 113 |
|
134 | | -# create-pr-on-downstream-repos: |
135 | | -# needs: [setup, build-image, snyk-container-scan] |
136 | | -# runs-on: ubuntu-latest |
137 | | -# env: |
138 | | -# IMAGE_NAME: ${{ needs.setup.outputs.image_name }} |
139 | | -# BRANCH_NAME: ${{ needs.setup.outputs.branch_name }} |
140 | | -# strategy: |
141 | | -# matrix: |
142 | | -# repo: [ differ, saver, dashboard, start-points-base ] |
143 | | -# steps: |
144 | | -# - uses: actions/checkout@v4 |
145 | | -# with: |
146 | | -# repository: cyber-dojo/${{ matrix.repo }} |
147 | | -# token: ${{ secrets.BASE_IMAGE_UPGRADE }} |
148 | | -# fetch-depth: 0 |
149 | | -# |
150 | | -# - name: Create branch |
151 | | -# run: |
152 | | -# git checkout -b ${BRANCH_NAME} |
153 | | -# |
154 | | -# - name: Edit 1st line of Dockerfile |
155 | | -# env: |
156 | | -# BASE_IMAGE: ${{ env.IMAGE_NAME }}@sha256:${{ needs.build-image.outputs.digest }} |
157 | | -# run: | |
158 | | -# cp Dockerfile Dockerfile.original |
159 | | -# echo "FROM ${BASE_IMAGE}" > Dockerfile |
160 | | -# cat Dockerfile.original | tail -n+2 >> Dockerfile |
161 | | -# rm Dockerfile.original |
162 | | -# |
163 | | -# - name: Commit |
164 | | -# run: | |
165 | | -# git config --global user.name "${{ github.actor }}" |
166 | | -# git config --global user.email "${{ github.event.sender.login }}@users.noreply.github.com" |
167 | | -# git add . |
168 | | -# git commit --message "Dockerfile - Automated base-image update" |
169 | | -# git push --set-upstream origin ${BRANCH_NAME} |
170 | | -# |
171 | | -# - name: Create pull request |
172 | | -# env: |
173 | | -# GH_TOKEN: ${{ secrets.BASE_IMAGE_UPGRADE }} |
174 | | -# run: |
175 | | -# gh pr create |
176 | | -# --base main |
177 | | -# --head ${BRANCH_NAME} |
178 | | -# --title 'Merge update-base-image into main' |
179 | | -# --body 'Created by Github action' |
| 114 | + create-pr-on-downstream-repos: |
| 115 | + needs: [setup, build-image, snyk-container-scan] |
| 116 | + runs-on: ubuntu-latest |
| 117 | + env: |
| 118 | + IMAGE_NAME: ${{ needs.setup.outputs.image_name }} |
| 119 | + BRANCH_NAME: ${{ needs.setup.outputs.branch_name }} |
| 120 | + strategy: |
| 121 | + matrix: |
| 122 | + repo: [ differ, saver, dashboard, start-points-base ] |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@v4 |
| 125 | + with: |
| 126 | + repository: cyber-dojo/${{ matrix.repo }} |
| 127 | + token: ${{ secrets.BASE_IMAGE_UPGRADE }} |
| 128 | + fetch-depth: 0 |
| 129 | + |
| 130 | + - name: Create branch |
| 131 | + run: |
| 132 | + git checkout -b ${BRANCH_NAME} |
| 133 | + |
| 134 | + - name: Edit 1st line of Dockerfile |
| 135 | + env: |
| 136 | + BASE_IMAGE: ${{ env.IMAGE_NAME }}@sha256:${{ needs.build-image.outputs.digest }} |
| 137 | + run: | |
| 138 | + cp Dockerfile Dockerfile.original |
| 139 | + echo "FROM ${BASE_IMAGE}" > Dockerfile |
| 140 | + cat Dockerfile.original | tail -n+2 >> Dockerfile |
| 141 | + rm Dockerfile.original |
| 142 | +
|
| 143 | + - name: Commit |
| 144 | + run: | |
| 145 | + git config --global user.name "${{ github.actor }}" |
| 146 | + git config --global user.email "${{ github.event.sender.login }}@users.noreply.github.com" |
| 147 | + git add . |
| 148 | + git commit --message "Dockerfile - Automated base-image update" |
| 149 | + git push --set-upstream origin ${BRANCH_NAME} |
| 150 | +
|
| 151 | + - name: Create pull request |
| 152 | + env: |
| 153 | + GH_TOKEN: ${{ secrets.BASE_IMAGE_UPGRADE }} |
| 154 | + run: |
| 155 | + gh pr create |
| 156 | + --base main |
| 157 | + --head ${BRANCH_NAME} |
| 158 | + --title 'Merge update-base-image into main' |
| 159 | + --body 'Created by Github action' |
0 commit comments