|
84 | 84 | BASIC_IMAGE: ccr.ccs.tencentyun.com/matrixone-dev/matrixone:ci-builder-amd64 |
85 | 85 | run: | |
86 | 86 | set +e |
87 | | - if timeout 300 docker pull "${BASIC_IMAGE}"; then |
88 | | - digest=$(docker image inspect --format '{{index .RepoDigests 0}}' "${BASIC_IMAGE}") |
| 87 | + PREBUILT_DOCKERFILE="$GITHUB_WORKSPACE/matrixone/optools/images/Dockerfile.prebuilt" |
| 88 | + if [ ! -f "${PREBUILT_DOCKERFILE}" ]; then |
| 89 | + echo "::notice::Dockerfile.prebuilt is not present in this checkout; using the source Dockerfile fallback" |
| 90 | + echo "ref=" >> "$GITHUB_OUTPUT" |
| 91 | + echo "tag=" >> "$GITHUB_OUTPUT" |
| 92 | + exit 0 |
| 93 | + fi |
| 94 | + # TCR is an optional optimization mirror. Keep a registry outage |
| 95 | + # from adding minutes to every post-merge regression before the |
| 96 | + # source Dockerfile fallback takes over. |
| 97 | + if timeout 90 docker pull "${BASIC_IMAGE}"; then |
| 98 | + repository="${BASIC_IMAGE%%:*}" |
| 99 | + digest=$(docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "${BASIC_IMAGE}" | |
| 100 | + awk -v prefix="${repository}@" 'index($0, prefix) == 1 { print; exit }') |
89 | 101 | if [ -n "${digest}" ]; then |
90 | 102 | echo "ref=${digest}" >> "$GITHUB_OUTPUT" |
91 | 103 | echo "tag=${BASIC_IMAGE}" >> "$GITHUB_OUTPUT" |
@@ -180,8 +192,11 @@ jobs: |
180 | 192 | tags: ${{ steps.prep.outputs.tags }} |
181 | 193 | file-path: ${{ github.workspace }}/matrixone/optools/images/Dockerfile.prebuilt |
182 | 194 | context: ${{ github.workspace }}/mo-runtime |
183 | | - cache-from: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-${{ github.base_ref }} |
184 | | - cache-to: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-${{ github.base_ref }},mode=max |
| 195 | + # Keep the tiny prebuilt image cache separate from the expensive |
| 196 | + # source-build cache. Otherwise a successful cached build erases the |
| 197 | + # source layers needed by the fallback path. |
| 198 | + cache-from: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-prebuilt-${{ github.base_ref }} |
| 199 | + cache-to: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-prebuilt-${{ github.base_ref }},mode=max |
185 | 200 | platform: linux/amd64 |
186 | 201 | build-args: | |
187 | 202 | RUNTIME_IMAGE=ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04 |
@@ -213,8 +228,8 @@ jobs: |
213 | 228 | tags: ${{ steps.prep.outputs.tags }} |
214 | 229 | file-path: ${{ github.workspace }}/matrixone/optools/images/Dockerfile |
215 | 230 | context: ${{ github.workspace }}/matrixone |
216 | | - cache-from: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-${{ github.base_ref }} |
217 | | - cache-to: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-${{ github.base_ref }},mode=max |
| 231 | + cache-from: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-source-${{ github.base_ref }} |
| 232 | + cache-to: type=registry,ref=${{ steps.prep.outputs.docker_image }}:cache-source-${{ github.base_ref }},mode=max |
218 | 233 | platform: linux/amd64 |
219 | 234 | build-args: | |
220 | 235 | GOPROXY=http://goproxy.goproxy.svc.cluster.local|https://goproxy.cn|direct |
|
0 commit comments