Skip to content

feat: Python standalone images from python-build-standalone #838

feat: Python standalone images from python-build-standalone

feat: Python standalone images from python-build-standalone #838

Workflow file for this run

name: Image Check
on:
workflow_dispatch:
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
pull-requests: write
jobs:
diff:
runs-on: distroless-ci-large-ubuntu-22.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: "1.25"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.cache/bazel-repo
key: bazel-cache-deps-ci2-${{ github.sha }}
restore-keys: |
bazel-cache-deps-ci2-${{ github.sha }}
bazel-cache-deps-ci2-
- name: Fetch
run: |
for i in $(seq 10); do
bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc cquery 'attr(tags, "amd64", ...)' && break
sleep 10;
done
- name: Build all images
run: bazel build //:sign_and_push
- name: Install Deps
run: |
go install github.com/google/go-containerregistry/cmd/crane@v0.21.6
go install github.com/reproducible-containers/diffoci/cmd/diffoci@v0.1.8
go install filippo.io/mkcert@latest
sudo curl -fsSL "https://github.com/project-zot/zot/releases/download/v2.0.2-rc2/zot-linux-amd64-minimal" > /usr/local/bin/zot
sudo chmod +x /usr/local/bin/zot
- name: Diff All Images
id: diff
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
./private/tools/diff/diff.bash \
--query-bazel --registry-spawn-https \
--head-ref "$HEAD_REF" \
--base-ref "$BASE_REF" \
--set-github-output-on-diff \
--skip-image-index \
--jobs $(($(nproc --all) * 2)) \
--logs ./verbose.log \
--report ./report.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
id: report
with:
name: "Report"
path: |
./verbose.log
./report.log
- name: Write diff to job output for forks
if: ${{ github.event.pull_request.head.repo.fork && steps.diff.outputs.changed_targets }}
env:
CHANGED: ${{ steps.diff.outputs.changed_targets }}
run: |
echo "This pull request has modified the following images:"
echo "$CHANGED"
- name: Find Comment
id: fc
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
GH_TOKEN: ${{ github.token }}
run: |
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
--jq '.[] | select(.user.login=="github-actions[bot]" and (.body | contains("馃尦 馃攧 Image Check"))) | .id' | head -n 1)
echo "comment-id=$COMMENT_ID" >> "$GITHUB_OUTPUT"
- name: Report diff
if: ${{ !github.event.pull_request.head.repo.fork && steps.diff.outputs.changed_targets }}
env:
GH_TOKEN: ${{ github.token }}
COMMENT_ID: ${{ steps.fc.outputs.comment-id }}
CHANGED: ${{ steps.diff.outputs.changed_targets }}
REPORT_URL: ${{ steps.report.outputs.artifact-url }}
run: |
BODY=$(cat <<EOF
馃尦 馃攧 Image Check
This pull request has modified the following images:
\`\`\`starlark
$CHANGED
\`\`\`
You can check the details in the report [here]($REPORT_URL)
EOF
)
if [ -n "$COMMENT_ID" ]; then
gh api -X PATCH repos/${{ github.repository }}/issues/comments/$COMMENT_ID -f body="$BODY"
else
gh api -X POST repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments -f body="$BODY"
fi
- name: Report no diff
if: ${{ !github.event.pull_request.head.repo.fork && !steps.diff.outputs.changed_targets }}
env:
GH_TOKEN: ${{ github.token }}
COMMENT_ID: ${{ steps.fc.outputs.comment-id }}
REPORT_URL: ${{ steps.report.outputs.artifact-url }}
run: |
BODY=$(cat <<EOF
馃尦 馃攧 Image Check
This pull request doesn't make any changes to the images. 馃憤
You can check the details in the report [here]($REPORT_URL)
EOF
)
if [ -n "$COMMENT_ID" ]; then
gh api -X PATCH repos/${{ github.repository }}/issues/comments/$COMMENT_ID -f body="$BODY"
else
gh api -X POST repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments -f body="$BODY"
fi