From 4281b971579d3eff1ae1051a400c1be4d9612ebc Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:25:28 +0000 Subject: [PATCH 01/13] ci: switch to more compliant pr title validator --- .github/CONTRIBUTING.md | 28 ++++++++++++--------- .github/workflows/ossf-scorecard.yml | 3 +-- .github/workflows/pr-conventional-title.yml | 13 ++++++---- .mega-linter.yml | 3 --- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ed6068e0..c976acef 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,8 +20,8 @@ Use your best judgment, and feel free to propose changes to this document in a p - [Want to improve the documentation?](#want-to-improve-the-documentation) - [Submission Guidelines](#submission-guidelines) - [Submitting an Issue](#submitting-an-issue) - - [Pull Request Title: Conventional Commits](#pull-request-title-conventional-commits) - - [Submitting a Pull Request (PR)](#submitting-a-pull-request-pr) + - [Naming a Pull Request (PR)](#naming-a-pull-request-pr) + - [Submitting a Pull Request](#submitting-a-pull-request) - [Reviewing a Pull Request](#reviewing-a-pull-request) - [Your First Contribution](#your-first-contribution) @@ -84,7 +84,7 @@ Unfortunately, we are not able to investigate/fix bugs without minimal reproduct You can file new issues by selecting from our new issue templates and filling out the issue template. -### Pull Request Title: Conventional Commits +### Naming a Pull Request (PR) The title of your Pull Request (PR) should follow the style of [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Not only does this present a standardized categorization of the kind of work done on a pull request, but it also instructs the release workflow to increment the correct level of the version according to the rules of [Semantic Versioning](https://semver.org/spec/v2.0.0.html). @@ -92,15 +92,19 @@ The format of the title of the pull request is this: `[(optional scope)][!]: ` -The `` of the pull request is one of these: +The `` of the pull request is one of these, taken from [conventional commit types](https://github.com/commitizen/conventional-commit-types): -- `feat:` adding new functionality -- `fix:` fixing a bug -- `test:` adding, improving, fixing tests -- `ci:` modifications on how GitHub interacts with the archive: workflows and configuration files -- `docs:` anything documentation related -- `refactor:` refactoring code, including applying formatters -- `chore:` a catch-all type for any other commits +- `feat:` a new feature +- `fix:` a bug fix +- `docs:` documentation only changes +- `style:` changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) +- `refactor:` a code change that neither fixes a bug nor adds a feature +- `perf:` a code change that improves performance +- `test:` adding missing tests or correcting existing tests +- `build:` changes that affect the build system or external dependencies +- `ci:` changes to our CI configuration files and scripts +- `chore:` other changes that don't modify source or test files +- `revert:` reverts a previous commit An exclamation mark `!` is added to the type if the change is not backwards compatible. This should only be added to `feat` or `fix`. @@ -120,7 +124,7 @@ Examples: > [!TIP] > If your work consists of a single commit, creating a pull request will default to the name of that commit. If you use conventional commit style for that single commit, your pull request already has the correct name. -### Submitting a Pull Request (PR) +### Submitting a Pull Request Before you submit your pull request consider the following guidelines: diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 153060bd..77818021 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -27,7 +27,6 @@ jobs: results_format: sarif repo_token: ${{ secrets.SCORECARD_TOKEN }} publish_results: true - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 + - uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 with: sarif_file: results.sarif diff --git a/.github/workflows/pr-conventional-title.yml b/.github/workflows/pr-conventional-title.yml index bc86c43e..d49c901d 100644 --- a/.github/workflows/pr-conventional-title.yml +++ b/.github/workflows/pr-conventional-title.yml @@ -15,9 +15,12 @@ jobs: validate-pr-title: runs-on: ubuntu-latest steps: - - uses: Namchee/conventional-pr@b31518c34a4243c21484e3187abbbee4a44d0ec4 # v0.15.4 + - uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0 with: - access_token: ${{ secrets.GITHUB_TOKEN }} - body: false - issue: false - close: false + subjectPattern: ^(?![A-Z]).+$ + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + doesn't start with an uppercase character. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.mega-linter.yml b/.mega-linter.yml index d10c1916..0e208843 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -12,9 +12,6 @@ DISABLE_LINTERS: - REPOSITORY_SEMGREP - JSON_JSONLINT - SPELL_CSPELL -DISABLE_ERRORS_LINTERS: - - MARKDOWN_MARKDOWN_LINK_CHECK - - SPELL_LYCHEE SARIF_REPORTER: true PRINT_ALPACA: false SHOW_SKIPPED_LINTERS: false From 33c06f6ee3c5b595edb805b4e67d5f26d405a111 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 10:50:02 +0000 Subject: [PATCH 02/13] ci: add container size diff to PR --- .github/container-size-diff/action.yml | 26 +++++++++++++ .../container-size-diff.sh | 38 +++++++++++++++++++ .github/workflows/ci.yml | 9 +++++ .github/workflows/ossf-scorecard.yml | 2 +- .github/workflows/pr-conventional-title.yml | 2 +- 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .github/container-size-diff/action.yml create mode 100755 .github/container-size-diff/container-size-diff.sh diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml new file mode 100644 index 00000000..bcd1d241 --- /dev/null +++ b/.github/container-size-diff/action.yml @@ -0,0 +1,26 @@ +--- +name: "Container Size Diff" +description: "Creates a Markdown summary of the size differences between two containers" + +inputs: + from-container: + description: "Baseline container image for size comparison" + required: true + to-container: + description: "Container image to be compared to the baseline" + required: true + +outputs: + size-diff-markdown: + description: "Markdown formatted output of container size comparison" + value: ${{ steps.size-diff.outputs.markdown }} + +runs: + using: "composite" + steps: + - run: echo "markdown=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" + id: size-diff + shell: bash + env: + INPUT_FROM_CONTAINER: ${{ inputs.from-container }} + INPUT_TO_CONTAINER: ${{ inputs.to-container }} diff --git a/.github/container-size-diff/container-size-diff.sh b/.github/container-size-diff/container-size-diff.sh new file mode 100755 index 00000000..fa070305 --- /dev/null +++ b/.github/container-size-diff/container-size-diff.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +FROM_CONTAINER=${1:?} +TO_CONTAINER=${2:?} + +get_sizes_from_manifest() { + local CONTAINER=${1:?} + declare -Ag ${2:?} + local -n SIZE_MAP=${2} + + for MANIFEST in $(docker manifest inspect -v ${CONTAINER} | jq -c 'if type == "array" then .[] else . end' | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .OCIManifest.layers[].size ] | add ) ] | join(":")'); + do + PLATFORM="${MANIFEST%%:*}" + SIZE="${MANIFEST#*:}" + + if [[ ${PLATFORM} != "unknown/unknown" ]]; + then + SIZE_MAP[${PLATFORM}]=${SIZE} + fi + done +} + +get_sizes_from_manifest ${FROM_CONTAINER} FROM_CONTAINER_SIZES +get_sizes_from_manifest ${TO_CONTAINER} TO_CONTAINER_SIZES + +echo "## Compressed layer size comparison" +echo +echo "Comparing ${FROM_CONTAINER} to ${TO_CONTAINER}" +echo +echo "| OS/Platform | Previous Size | Current Size | Delta |" +echo "|-------------|---------------|--------------|-------|" +for PLATFORM in "${!FROM_CONTAINER_SIZES[@]}"; +do + BASE_SIZE=${FROM_CONTAINER_SIZES[${PLATFORM}]} + HEAD_SIZE=${TO_CONTAINER_SIZES[${PLATFORM}]} + + echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${BASE_SIZE}) | $(numfmt --to iec --format '%.2f' ${HEAD_SIZE}) | $(numfmt --to iec --format '%.2f' -- $((${HEAD_SIZE} - ${BASE_SIZE}))) $(python -c "print('({:+0.2f}%)'.format(((${HEAD_SIZE} - ${BASE_SIZE}) / ${BASE_SIZE}) * 100))") |"; +done diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20c6ae8c..50abfd1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,15 @@ jobs: tags: ${{ github.repository }}:test cache-from: type=gha cache-to: type=gha,mode=max + - uses: ./.github/container-size-diff + id: container-size-diff + with: + from-container: ghcr.io/${{ github.repository }}:latest + to-container: ghcr.io/${{ github.repository }}:test + - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 + with: + header: container-size-diff + message: ${{ steps.container-size-diff.outputs.markdown }} - uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: path: test/.xwin-cache diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 77818021..34109298 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -1,5 +1,5 @@ --- -name: Supply-chain security +name: Supply-chain Security on: workflow_dispatch: diff --git a/.github/workflows/pr-conventional-title.yml b/.github/workflows/pr-conventional-title.yml index d49c901d..debeabc6 100644 --- a/.github/workflows/pr-conventional-title.yml +++ b/.github/workflows/pr-conventional-title.yml @@ -1,5 +1,5 @@ --- -name: Pull request Conventional Title +name: Pull Request Conventional Title on: pull_request: From 8ae8686057996ceaab9c506f481ac87ff794f1a3 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 10:59:40 +0000 Subject: [PATCH 03/13] ci: update path to script --- .github/container-size-diff/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index bcd1d241..bf954cc2 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -18,7 +18,9 @@ outputs: runs: using: "composite" steps: - - run: echo "markdown=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" + - run: | + set -Eeuo pipefail + echo "markdown=$(./container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" id: size-diff shell: bash env: From 979f1fac0076fc7d7927c226a4343df283ceff0e Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:02:11 +0000 Subject: [PATCH 04/13] ci: use correct output key --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0271692..9831a447 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 with: header: container-size-diff - message: ${{ steps.container-size-diff.outputs.markdown }} + message: ${{ steps.container-size-diff.outputs.size-diff-markdown }} - uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: path: test/.xwin-cache From 8707a6073f938c830cc21fb9fdf0b41e2fc4fcc2 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:04:37 +0000 Subject: [PATCH 05/13] ci: fix access to script from composite action --- .github/container-size-diff/action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index bf954cc2..082f31af 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -18,9 +18,11 @@ outputs: runs: using: "composite" steps: - - run: | - set -Eeuo pipefail - echo "markdown=$(./container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" + - run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH + shell: bash + env: + GITHUB_ACTION_PATH: ${{ github.action_path }} + - run: echo "markdown=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" id: size-diff shell: bash env: From 7fe5825fa7e6d68da18ece5aa4a17ab915d6dfcf Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:10:59 +0000 Subject: [PATCH 06/13] ci: try and fix multi-line output --- .github/container-size-diff/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index 082f31af..6a9e0b8d 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -22,7 +22,12 @@ runs: shell: bash env: GITHUB_ACTION_PATH: ${{ github.action_path }} - - run: echo "markdown=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "$GITHUB_OUTPUT" + - run: | + { + echo "markdown<> "$GITHUB_OUTPUT" id: size-diff shell: bash env: From c929996a8c0e70878a5ca6f7989881ae52b31266 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:48:04 +0000 Subject: [PATCH 07/13] ci: move container size diff to build-push workflow --- .github/workflows/build-push.yml | 9 +++++++++ .github/workflows/ci.yml | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 129a073b..89a0838e 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -103,6 +103,15 @@ jobs: sbom: true provenance: true cache-from: type=gha + - uses: ./.github/container-size-diff + id: container-size-diff + with: + from-container: ghcr.io/${{ github.repository }}:latest + to-container: ghcr.io/${{ github.repository }}:${{ steps.build-and-push-base.outputs.digest }} + - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 + with: + header: container-size-diff + message: ${{ steps.container-size-diff.outputs.size-diff-markdown }} - uses: anchore/sbom-action@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8 if: steps.build-and-push-base.outputs.digest != '' && github.event_name != 'merge_group' with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9831a447..f7ef1321 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,6 @@ jobs: tags: ${{ github.repository }}:test cache-from: type=gha cache-to: type=gha,mode=max - - uses: ./.github/container-size-diff - id: container-size-diff - with: - from-container: ghcr.io/${{ github.repository }}:latest - to-container: ghcr.io/${{ github.repository }}:test - - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 - with: - header: container-size-diff - message: ${{ steps.container-size-diff.outputs.size-diff-markdown }} - uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: path: test/.xwin-cache From a125eb25e8bbf7cdeaf4784d03a2e45135feb100 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:48:17 +0000 Subject: [PATCH 08/13] ci: try fix markdown formatting --- .github/container-size-diff/container-size-diff.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/container-size-diff/container-size-diff.sh b/.github/container-size-diff/container-size-diff.sh index fa070305..21da5f4d 100755 --- a/.github/container-size-diff/container-size-diff.sh +++ b/.github/container-size-diff/container-size-diff.sh @@ -23,16 +23,14 @@ get_sizes_from_manifest() { get_sizes_from_manifest ${FROM_CONTAINER} FROM_CONTAINER_SIZES get_sizes_from_manifest ${TO_CONTAINER} TO_CONTAINER_SIZES -echo "## Compressed layer size comparison" -echo -echo "Comparing ${FROM_CONTAINER} to ${TO_CONTAINER}" -echo -echo "| OS/Platform | Previous Size | Current Size | Delta |" -echo "|-------------|---------------|--------------|-------|" +echo "## Compressed layer size comparison\n\n" +echo "Comparing ${FROM_CONTAINER} to ${TO_CONTAINER}\n\n" +echo "| OS/Platform | Previous Size | Current Size | Delta |\n" +echo "|-------------|---------------|--------------|-------|\n" for PLATFORM in "${!FROM_CONTAINER_SIZES[@]}"; do BASE_SIZE=${FROM_CONTAINER_SIZES[${PLATFORM}]} HEAD_SIZE=${TO_CONTAINER_SIZES[${PLATFORM}]} - echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${BASE_SIZE}) | $(numfmt --to iec --format '%.2f' ${HEAD_SIZE}) | $(numfmt --to iec --format '%.2f' -- $((${HEAD_SIZE} - ${BASE_SIZE}))) $(python -c "print('({:+0.2f}%)'.format(((${HEAD_SIZE} - ${BASE_SIZE}) / ${BASE_SIZE}) * 100))") |"; + echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${BASE_SIZE}) | $(numfmt --to iec --format '%.2f' ${HEAD_SIZE}) | $(numfmt --to iec --format '%.2f' -- $((${HEAD_SIZE} - ${BASE_SIZE}))) $(python -c "print('({:+0.2f}%)'.format(((${HEAD_SIZE} - ${BASE_SIZE}) / ${BASE_SIZE}) * 100))") |\n" done From 293d678db30759c509c6dd2528062067f7515cd6 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:58:33 +0000 Subject: [PATCH 09/13] ci: try to fix formatting --- .github/container-size-diff/container-size-diff.sh | 12 +++++++----- .github/workflows/build-push.yml | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/container-size-diff/container-size-diff.sh b/.github/container-size-diff/container-size-diff.sh index 21da5f4d..fa070305 100755 --- a/.github/container-size-diff/container-size-diff.sh +++ b/.github/container-size-diff/container-size-diff.sh @@ -23,14 +23,16 @@ get_sizes_from_manifest() { get_sizes_from_manifest ${FROM_CONTAINER} FROM_CONTAINER_SIZES get_sizes_from_manifest ${TO_CONTAINER} TO_CONTAINER_SIZES -echo "## Compressed layer size comparison\n\n" -echo "Comparing ${FROM_CONTAINER} to ${TO_CONTAINER}\n\n" -echo "| OS/Platform | Previous Size | Current Size | Delta |\n" -echo "|-------------|---------------|--------------|-------|\n" +echo "## Compressed layer size comparison" +echo +echo "Comparing ${FROM_CONTAINER} to ${TO_CONTAINER}" +echo +echo "| OS/Platform | Previous Size | Current Size | Delta |" +echo "|-------------|---------------|--------------|-------|" for PLATFORM in "${!FROM_CONTAINER_SIZES[@]}"; do BASE_SIZE=${FROM_CONTAINER_SIZES[${PLATFORM}]} HEAD_SIZE=${TO_CONTAINER_SIZES[${PLATFORM}]} - echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${BASE_SIZE}) | $(numfmt --to iec --format '%.2f' ${HEAD_SIZE}) | $(numfmt --to iec --format '%.2f' -- $((${HEAD_SIZE} - ${BASE_SIZE}))) $(python -c "print('({:+0.2f}%)'.format(((${HEAD_SIZE} - ${BASE_SIZE}) / ${BASE_SIZE}) * 100))") |\n" + echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${BASE_SIZE}) | $(numfmt --to iec --format '%.2f' ${HEAD_SIZE}) | $(numfmt --to iec --format '%.2f' -- $((${HEAD_SIZE} - ${BASE_SIZE}))) $(python -c "print('({:+0.2f}%)'.format(((${HEAD_SIZE} - ${BASE_SIZE}) / ${BASE_SIZE}) * 100))") |"; done diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 89a0838e..91c9635e 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -106,12 +106,12 @@ jobs: - uses: ./.github/container-size-diff id: container-size-diff with: - from-container: ghcr.io/${{ github.repository }}:latest - to-container: ghcr.io/${{ github.repository }}:${{ steps.build-and-push-base.outputs.digest }} + from-container: ${{ env.REGISTRY }}/${{ github.repository }}:latest + to-container: ${{ env.REGISTRY }}/${{ github.repository }}@${{ steps.build-and-push-base.outputs.digest }} - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 with: header: container-size-diff - message: ${{ steps.container-size-diff.outputs.size-diff-markdown }} + message: "${{ steps.container-size-diff.outputs.size-diff-markdown }}" - uses: anchore/sbom-action@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8 if: steps.build-and-push-base.outputs.digest != '' && github.event_name != 'merge_group' with: From f141d71cdfab6cc231344b2adb27285e8207d466 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 13:05:46 +0000 Subject: [PATCH 10/13] ci: formatting --- .github/workflows/build-push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 91c9635e..075d577c 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -111,7 +111,8 @@ jobs: - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 with: header: container-size-diff - message: "${{ steps.container-size-diff.outputs.size-diff-markdown }}" + message: | + ${{ steps.container-size-diff.outputs.size-diff-markdown }} - uses: anchore/sbom-action@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8 if: steps.build-and-push-base.outputs.digest != '' && github.event_name != 'merge_group' with: From d23bcff0a904ee03ded5d08130e8504c4a2ad879 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:03:16 +0000 Subject: [PATCH 11/13] ci: test another way of escaping newlines --- .github/container-size-diff/action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index 6a9e0b8d..ce72721f 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -23,11 +23,12 @@ runs: env: GITHUB_ACTION_PATH: ${{ github.action_path }} - run: | - { - echo "markdown<> "$GITHUB_OUTPUT" + MARKDOWN=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER}) + MARKDOWN="${MARKDOWN//'%'/'%25'}" + MARKDOWN="${MARKDOWN//$'\n'/'%0A'}" + MARKDOWN="${MARKDOWN//$'\r'/'%0D'}" + + echo "markdown=${MARKDOWN}" >> "$GITHUB_OUTPUT" id: size-diff shell: bash env: From ad426bd329faf509b4af58812d2f898ac81e1a2c Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:05:14 +0000 Subject: [PATCH 12/13] ci: suppress bash word splitting on input --- .github/container-size-diff/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index ce72721f..bcc45609 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -23,7 +23,7 @@ runs: env: GITHUB_ACTION_PATH: ${{ github.action_path }} - run: | - MARKDOWN=$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER}) + MARKDOWN="$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" MARKDOWN="${MARKDOWN//'%'/'%25'}" MARKDOWN="${MARKDOWN//$'\n'/'%0A'}" MARKDOWN="${MARKDOWN//$'\r'/'%0D'}" From 7802e0a204a957b4b81969846aedb2932492d075 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:46:10 +0000 Subject: [PATCH 13/13] ci: will this work? --- .github/container-size-diff/action.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/container-size-diff/action.yml b/.github/container-size-diff/action.yml index bcc45609..83549bf2 100644 --- a/.github/container-size-diff/action.yml +++ b/.github/container-size-diff/action.yml @@ -23,12 +23,10 @@ runs: env: GITHUB_ACTION_PATH: ${{ github.action_path }} - run: | - MARKDOWN="$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" - MARKDOWN="${MARKDOWN//'%'/'%25'}" - MARKDOWN="${MARKDOWN//$'\n'/'%0A'}" - MARKDOWN="${MARKDOWN//$'\r'/'%0D'}" - - echo "markdown=${MARKDOWN}" >> "$GITHUB_OUTPUT" + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "markdown<<${EOF}" >> "${GITHUB_OUTPUT}" + echo "$(container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "${GITHUB_OUTPUT}" + echo "${EOF}" >> "${GITHUB_OUTPUT}" id: size-diff shell: bash env: