From 30633ab1e6d462c62e3056a87c1be3505df95d2e Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 5 Apr 2024 13:44:04 +0300 Subject: [PATCH 01/15] ci: changes --- .github/workflows/auto-merge-release.yaml | 3 ++- .github/workflows/build.yml | 26 ++++++++++++++++++----- .github/workflows/shellcheck.yml | 3 ++- .github/workflows/test.yml | 7 +++--- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/auto-merge-release.yaml b/.github/workflows/auto-merge-release.yaml index 084a3e1..7c8456b 100644 --- a/.github/workflows/auto-merge-release.yaml +++ b/.github/workflows/auto-merge-release.yaml @@ -3,7 +3,8 @@ # https://github.com/peter-evans/enable-pull-request-automerge on: # yamllint disable-line rule:truthy - pull_request: + # pull_request: + workflow_dispatch: permissions: pull-requests: write diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b97a74..1d5bc71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,9 @@ on: # yamllint disable-line rule:truthy push: branches: - master + pull_request: + branches: + - master release: types: - released @@ -158,11 +161,10 @@ jobs: - name: Print downloaded bake meta files run: | - ls -la /tmp - - - name: Print downloaded digests - run: | - ls -la /tmp/digests + echo "Listing /tmp directory contents:" + ls -lah /tmp + echo "Listing /tmp/digests directory contents:" + ls -lah /tmp/digests - name: 🔑 Login to docker-hub uses: docker/login-action@v3 @@ -190,21 +192,35 @@ jobs: - name: Create manifest list and push run: | + # Debug: List all matching meta files + echo "Listing all bake-meta-*.json files for debugging:" + ls -la /tmp/bake-meta-*.json + # Aggregate all tags from the meta files TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) + echo "Found tags: $TAGS" # Loop through each tag and create a manifest list for TAG in $TAGS; do + echo "Processing tag: $TAG" FULL_TAGS=() for FILE in /tmp/bake-meta-*.json; do + if [ -d "$FILE" ]; then + echo "$FILE is a directory, skipping..." + continue + fi if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then # Extract the repository and digest for the current platform REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) DIGEST=$(jq -r '.["'$REPO'"]["containerimage.digest"]' $FILE) + echo "Adding $REPO@$DIGEST to FULL_TAGS" FULL_TAGS+=("$REPO@$DIGEST") fi done + # Debug: Print FULL_TAGS before creating the manifest + echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" + # Create and push the manifest list for the current tag docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" done diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index d23d164..4e6239f 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,7 +1,8 @@ --- on: # yamllint disable-line rule:truthy - pull_request: + # pull_request: + workflow_dispatch: name: 🐞 Differential shell-check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06626cf..c636d3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,9 +5,10 @@ concurrency: cancel-in-progress: true on: - pull_request: - paths-ignore: - - '**.md' + workflow_dispatch: +# pull_request: +# paths-ignore: +# - '**.md' env: DOCKER_NAMESPACE: wayofdev/php-base From b95b4172ebac12f92ede4d4847a73ae7fb76e8a4 Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 5 Apr 2024 13:50:16 +0300 Subject: [PATCH 02/15] ci: changes --- .github/workflows/build.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d5bc71..76a83bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: os_name: ["alpine"] - php_version: ["8.1", "8.2", "8.3"] - php_type: ["fpm", "cli", "supervisord"] + php_version: ["8.1", "8.2"] # , "8.3" + php_type: ["fpm"] # , "cli", "supervisord" builder: [{arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] runs-on: ${{ matrix.builder.os }} steps: @@ -192,9 +192,9 @@ jobs: - name: Create manifest list and push run: | - # Debug: List all matching meta files + # Debug: List all matching meta files more clearly echo "Listing all bake-meta-*.json files for debugging:" - ls -la /tmp/bake-meta-*.json + find /tmp -name 'bake-meta-*.json' -exec ls -l {} \; # Aggregate all tags from the meta files TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) @@ -204,11 +204,7 @@ jobs: for TAG in $TAGS; do echo "Processing tag: $TAG" FULL_TAGS=() - for FILE in /tmp/bake-meta-*.json; do - if [ -d "$FILE" ]; then - echo "$FILE is a directory, skipping..." - continue - fi + for FILE in $(find /tmp -name 'bake-meta-*.json'); do if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then # Extract the repository and digest for the current platform REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) From 2ebac9b9481b130e5b60c5c8f8c0a2898fcaec34 Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 5 Apr 2024 14:00:29 +0300 Subject: [PATCH 03/15] ci: changes --- .github/workflows/build.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76a83bd..e36b940 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: os_name: ["alpine"] - php_version: ["8.1", "8.2"] # , "8.3" - php_type: ["fpm"] # , "cli", "supervisord" + php_version: ["8.1", "8.2", "8.3"] + php_type: ["fpm", "cli", "supervisord"] builder: [{arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] runs-on: ${{ matrix.builder.os }} steps: @@ -152,12 +152,14 @@ jobs: with: pattern: bake-meta-* path: /tmp + merge-multiple: true - name: 📥 Download meta bake definitions uses: actions/download-artifact@v4 with: pattern: digests-* path: /tmp/digests/* + merge-multiple: true - name: Print downloaded bake meta files run: | @@ -192,9 +194,9 @@ jobs: - name: Create manifest list and push run: | - # Debug: List all matching meta files more clearly + # Debug: List all matching meta files echo "Listing all bake-meta-*.json files for debugging:" - find /tmp -name 'bake-meta-*.json' -exec ls -l {} \; + ls -la /tmp/bake-meta-*.json # Aggregate all tags from the meta files TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) @@ -204,7 +206,11 @@ jobs: for TAG in $TAGS; do echo "Processing tag: $TAG" FULL_TAGS=() - for FILE in $(find /tmp -name 'bake-meta-*.json'); do + for FILE in /tmp/bake-meta-*.json; do + if [ -d "$FILE" ]; then + echo "$FILE is a directory, skipping..." + continue + fi if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then # Extract the repository and digest for the current platform REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) From 5ccb0e9993435dcf7305618f67a02b2c7007744e Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 5 Apr 2024 15:54:24 +0300 Subject: [PATCH 04/15] ci: changes --- .github/workflows/build.yml | 80 ++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e36b940..bda8a91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -194,37 +194,71 @@ jobs: - name: Create manifest list and push run: | - # Debug: List all matching meta files - echo "Listing all bake-meta-*.json files for debugging:" - ls -la /tmp/bake-meta-*.json - - # Aggregate all tags from the meta files - TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) - echo "Found tags: $TAGS" + for FILE in $(find /tmp -name 'bake-meta-*.json'); do + echo "Processing file: $FILE" + cat "$FILE" | jq + done - # Loop through each tag and create a manifest list for TAG in $TAGS; do echo "Processing tag: $TAG" FULL_TAGS=() - for FILE in /tmp/bake-meta-*.json; do - if [ -d "$FILE" ]; then - echo "$FILE is a directory, skipping..." - continue + for FILE in $(find /tmp -name 'bake-meta-*.json'); do + echo "Processing file: $FILE" + # Debug: Print the structure of the JSON file + cat "$FILE" | jq + + REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) + DIGEST=$(jq -r --arg REPO "$REPO" '.["'$REPO'"]["containerimage.digest"]' $FILE) + + if [ "$DIGEST" == "null" ] || [ -z "$DIGEST" ]; then + echo "Digest not found for $REPO in $FILE" + continue # Skip adding this to FULL_TAGS fi - if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then - # Extract the repository and digest for the current platform - REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) - DIGEST=$(jq -r '.["'$REPO'"]["containerimage.digest"]' $FILE) - echo "Adding $REPO@$DIGEST to FULL_TAGS" + + echo "Adding $REPO@$DIGEST to FULL_TAGS" FULL_TAGS+=("$REPO@$DIGEST") - fi - done + done - # Debug: Print FULL_TAGS before creating the manifest - echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" + if [ ${#FULL_TAGS[@]} -eq 0 ]; then + echo "No valid digests found for tag $TAG, skipping..." + continue + fi - # Create and push the manifest list for the current tag - docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" + echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" + docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" done +# # Debug: List all matching meta files +# echo "Listing all bake-meta-*.json files for debugging:" +# ls -la /tmp/bake-meta-*.json +# +# # Aggregate all tags from the meta files +# TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) +# echo "Found tags: $TAGS" +# +# # Loop through each tag and create a manifest list +# for TAG in $TAGS; do +# echo "Processing tag: $TAG" +# FULL_TAGS=() +# for FILE in /tmp/bake-meta-*.json; do +# if [ -d "$FILE" ]; then +# echo "$FILE is a directory, skipping..." +# continue +# fi +# if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then +# # Extract the repository and digest for the current platform +# REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) +# DIGEST=$(jq -r '.["'$REPO'"]["containerimage.digest"]' $FILE) +# echo "Adding $REPO@$DIGEST to FULL_TAGS" +# FULL_TAGS+=("$REPO@$DIGEST") +# fi +# done +# +# # Debug: Print FULL_TAGS before creating the manifest +# echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" +# +# # Create and push the manifest list for the current tag +# docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" +# done + ... From a14d17c2fd98e3a8e7cb196d0e6870d8c9a721f6 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 01:49:16 +0300 Subject: [PATCH 05/15] ci: changes --- .github/workflows/build.yml | 140 ++++++++++++++++++++---------------- 1 file changed, 78 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bda8a91..1a1f990 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: os_name: ["alpine"] - php_version: ["8.1", "8.2", "8.3"] - php_type: ["fpm", "cli", "supervisord"] + php_version: ["8.1"] # , "8.2", "8.3" + php_type: ["fpm"] # , "cli", "supervisord" builder: [{arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] runs-on: ${{ matrix.builder.os }} steps: @@ -137,7 +137,7 @@ jobs: - name: 📤 Upload digest uses: actions/upload-artifact@v4 with: - name: digests-${{ env.PLATFORM_CACHE_TAG }}.json + name: digests-${{ env.PLATFORM_CACHE_TAG }} path: /tmp/digests/* if-no-files-found: error retention-days: 1 @@ -159,74 +159,90 @@ jobs: with: pattern: digests-* path: /tmp/digests/* - merge-multiple: true - name: Print downloaded bake meta files run: | echo "Listing /tmp directory contents:" ls -lah /tmp + + - name: Print downloaded digest files + run: | echo "Listing /tmp/digests directory contents:" ls -lah /tmp/digests - - name: 🔑 Login to docker-hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: 🔑 Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: 🖥️ Setup docker QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: linux/amd64,linux/arm64 - - - name: 🛠️ Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - platforms: linux/amd64,linux/arm64 - buildkitd-flags: "--debug" - - - name: Create manifest list and push + - name: Print downloaded digest files run: | - for FILE in $(find /tmp -name 'bake-meta-*.json'); do - echo "Processing file: $FILE" - cat "$FILE" | jq - done - - for TAG in $TAGS; do - echo "Processing tag: $TAG" - FULL_TAGS=() - for FILE in $(find /tmp -name 'bake-meta-*.json'); do - echo "Processing file: $FILE" - # Debug: Print the structure of the JSON file - cat "$FILE" | jq - - REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) - DIGEST=$(jq -r --arg REPO "$REPO" '.["'$REPO'"]["containerimage.digest"]' $FILE) - - if [ "$DIGEST" == "null" ] || [ -z "$DIGEST" ]; then - echo "Digest not found for $REPO in $FILE" - continue # Skip adding this to FULL_TAGS - fi - - echo "Adding $REPO@$DIGEST to FULL_TAGS" - FULL_TAGS+=("$REPO@$DIGEST") - done - - if [ ${#FULL_TAGS[@]} -eq 0 ]; then - echo "No valid digests found for tag $TAG, skipping..." - continue - fi - - echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" - docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" - done + echo "Listing /tmp/digests directory contents:" + ls -lah /tmp/digests/digests-8.1-fpm-alpine-amd64/ + ls -lah /tmp/digests/digests-8.1-fpm-alpine-arm64/ + +# - name: 🔑 Login to docker-hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_TOKEN }} +# +# - name: 🔑 Login to GHCR +# uses: docker/login-action@v3 +# with: +# registry: ghcr.io +# username: ${{ github.repository_owner }} +# password: ${{ secrets.GITHUB_TOKEN }} +# +# - name: 🖥️ Setup docker QEMU +# uses: docker/setup-qemu-action@v3 +# with: +# platforms: linux/amd64,linux/arm64 +# +# - name: 🛠️ Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# with: +# platforms: linux/amd64,linux/arm64 +# buildkitd-flags: "--debug" + +# - name: Create manifest list and push +# working-directory: /tmp/digests +# run: | +# docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.DOCKER_NAMESPACE }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ +# $(printf '${{ env.DOCKERHUB_SLUG }}@sha256:%s ' *) +# docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.GHCR_NAMESPACE }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ +# $(printf '${{ env.GHCR_SLUG }}@sha256:%s ' *) +# +# - name: Create manifest list and push +# run: | +# for FILE in $(find /tmp -name 'bake-meta-*.json'); do +# echo "Processing file: $FILE" +# cat "$FILE" | jq +# done +# +# for TAG in $TAGS; do +# echo "Processing tag: $TAG" +# FULL_TAGS=() +# for FILE in $(find /tmp -name 'bake-meta-*.json'); do +# echo "Processing file: $FILE" +# # Debug: Print the structure of the JSON file +# cat "$FILE" | jq +# +# REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) +# DIGEST=$(jq -r --arg REPO "$REPO" '.["'$REPO'"]["containerimage.digest"]' $FILE) +# +# if [ "$DIGEST" == "null" ] || [ -z "$DIGEST" ]; then +# echo "Digest not found for $REPO in $FILE" +# continue # Skip adding this to FULL_TAGS +# fi +# +# echo "Adding $REPO@$DIGEST to FULL_TAGS" +# FULL_TAGS+=("$REPO@$DIGEST") +# done +# +# if [ ${#FULL_TAGS[@]} -eq 0 ]; then +# echo "No valid digests found for tag $TAG, skipping..." +# continue +# fi +# +# echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" +# docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" +# done # # Debug: List all matching meta files # echo "Listing all bake-meta-*.json files for debugging:" From 20156a46f5ea69e1744544e54f4b4e2188756b30 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 02:14:35 +0300 Subject: [PATCH 06/15] ci: changes --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a1f990..8ad8579 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,6 +159,7 @@ jobs: with: pattern: digests-* path: /tmp/digests/* + merge-multiple: true - name: Print downloaded bake meta files run: | From 2769599ac49fd7c546d9c0fe10686f51a8a515ad Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 02:16:47 +0300 Subject: [PATCH 07/15] ci: changes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ad8579..633b486 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,7 +138,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: digests-${{ env.PLATFORM_CACHE_TAG }} - path: /tmp/digests/* + path: /tmp/digests if-no-files-found: error retention-days: 1 From 7dfd61c16388937a95fb5401fa7802812eaf7bbb Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 02:24:49 +0300 Subject: [PATCH 08/15] ci: changes --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 633b486..ab75a58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,7 +138,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: digests-${{ env.PLATFORM_CACHE_TAG }} - path: /tmp/digests + path: /tmp/digests/* if-no-files-found: error retention-days: 1 @@ -158,8 +158,7 @@ jobs: uses: actions/download-artifact@v4 with: pattern: digests-* - path: /tmp/digests/* - merge-multiple: true + path: /tmp/digests - name: Print downloaded bake meta files run: | From e140a6bab27957791816cfd881c557acd2e76df0 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 02:57:26 +0300 Subject: [PATCH 09/15] ci: changes --- .github/workflows/build.yml | 141 +++++++++++------------------------- 1 file changed, 41 insertions(+), 100 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab75a58..b3d95b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,105 +176,46 @@ jobs: ls -lah /tmp/digests/digests-8.1-fpm-alpine-amd64/ ls -lah /tmp/digests/digests-8.1-fpm-alpine-arm64/ -# - name: 🔑 Login to docker-hub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_TOKEN }} -# -# - name: 🔑 Login to GHCR -# uses: docker/login-action@v3 -# with: -# registry: ghcr.io -# username: ${{ github.repository_owner }} -# password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: 🖥️ Setup docker QEMU -# uses: docker/setup-qemu-action@v3 -# with: -# platforms: linux/amd64,linux/arm64 -# -# - name: 🛠️ Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# with: -# platforms: linux/amd64,linux/arm64 -# buildkitd-flags: "--debug" - -# - name: Create manifest list and push -# working-directory: /tmp/digests -# run: | -# docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.DOCKER_NAMESPACE }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ -# $(printf '${{ env.DOCKERHUB_SLUG }}@sha256:%s ' *) -# docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.GHCR_NAMESPACE }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ -# $(printf '${{ env.GHCR_SLUG }}@sha256:%s ' *) -# -# - name: Create manifest list and push -# run: | -# for FILE in $(find /tmp -name 'bake-meta-*.json'); do -# echo "Processing file: $FILE" -# cat "$FILE" | jq -# done -# -# for TAG in $TAGS; do -# echo "Processing tag: $TAG" -# FULL_TAGS=() -# for FILE in $(find /tmp -name 'bake-meta-*.json'); do -# echo "Processing file: $FILE" -# # Debug: Print the structure of the JSON file -# cat "$FILE" | jq -# -# REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) -# DIGEST=$(jq -r --arg REPO "$REPO" '.["'$REPO'"]["containerimage.digest"]' $FILE) -# -# if [ "$DIGEST" == "null" ] || [ -z "$DIGEST" ]; then -# echo "Digest not found for $REPO in $FILE" -# continue # Skip adding this to FULL_TAGS -# fi -# -# echo "Adding $REPO@$DIGEST to FULL_TAGS" -# FULL_TAGS+=("$REPO@$DIGEST") -# done -# -# if [ ${#FULL_TAGS[@]} -eq 0 ]; then -# echo "No valid digests found for tag $TAG, skipping..." -# continue -# fi -# -# echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" -# docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" -# done - -# # Debug: List all matching meta files -# echo "Listing all bake-meta-*.json files for debugging:" -# ls -la /tmp/bake-meta-*.json -# -# # Aggregate all tags from the meta files -# TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/bake-meta-*.json | sort -u) -# echo "Found tags: $TAGS" -# -# # Loop through each tag and create a manifest list -# for TAG in $TAGS; do -# echo "Processing tag: $TAG" -# FULL_TAGS=() -# for FILE in /tmp/bake-meta-*.json; do -# if [ -d "$FILE" ]; then -# echo "$FILE is a directory, skipping..." -# continue -# fi -# if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then -# # Extract the repository and digest for the current platform -# REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) -# DIGEST=$(jq -r '.["'$REPO'"]["containerimage.digest"]' $FILE) -# echo "Adding $REPO@$DIGEST to FULL_TAGS" -# FULL_TAGS+=("$REPO@$DIGEST") -# fi -# done -# -# # Debug: Print FULL_TAGS before creating the manifest -# echo "FULL_TAGS for $TAG: ${FULL_TAGS[@]}" -# -# # Create and push the manifest list for the current tag -# docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" -# done + - name: 🔑 Login to docker-hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: 🔑 Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: 🖥️ Setup docker QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: 🛠️ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + buildkitd-flags: "--debug" + + - name: 🚀 Create manifest list and push + run: | + # Fetch digests for amd64 and arm64 architectures + DIGEST_AMD64=$(cat /tmp/digests/digests-8.1-fpm-alpine-amd64/*) + DIGEST_ARM64=$(cat /tmp/digests/digests-8.1-fpm-alpine-arm64/*) + echo "Digest AMD64: $DIGEST_AMD64" + echo "Digest ARM64: $DIGEST_ARM64" + + # Create the manifest list for Docker Hub + docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${DOCKER_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-8.1-fpm-alpine-amd64.json) \ + "${DOCKER_NAMESPACE}@sha256:${DIGEST_AMD64}" \ + "${DOCKER_NAMESPACE}@sha256:${DIGEST_ARM64}" + + # Create the manifest list for GHCR + docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${GHCR_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-8.1-fpm-alpine-amd64.json) \ + "${GHCR_NAMESPACE}@sha256:${DIGEST_AMD64}" \ + "${GHCR_NAMESPACE}@sha256:${DIGEST_ARM64}" ... From 466ae6e83b6dc3ef05f73c8bdf8d174844e50beb Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 03:05:26 +0300 Subject: [PATCH 10/15] ci: changes --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3d95b0..5e752b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,8 +203,8 @@ jobs: - name: 🚀 Create manifest list and push run: | # Fetch digests for amd64 and arm64 architectures - DIGEST_AMD64=$(cat /tmp/digests/digests-8.1-fpm-alpine-amd64/*) - DIGEST_ARM64=$(cat /tmp/digests/digests-8.1-fpm-alpine-arm64/*) + DIGEST_AMD64=$(ls /tmp/digests/digests-8.1-fpm-alpine-amd64/*) + DIGEST_ARM64=$(ls /tmp/digests/digests-8.1-fpm-alpine-arm64/*) echo "Digest AMD64: $DIGEST_AMD64" echo "Digest ARM64: $DIGEST_ARM64" From cc4108c46899f5b94e9e916165e51b5dfed9e484 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 03:10:18 +0300 Subject: [PATCH 11/15] ci: changes --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e752b5..430e945 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,8 +203,8 @@ jobs: - name: 🚀 Create manifest list and push run: | # Fetch digests for amd64 and arm64 architectures - DIGEST_AMD64=$(ls /tmp/digests/digests-8.1-fpm-alpine-amd64/*) - DIGEST_ARM64=$(ls /tmp/digests/digests-8.1-fpm-alpine-arm64/*) + DIGEST_AMD64=$(basename $(ls /tmp/digests/digests-8.1-fpm-alpine-amd64/*)) + DIGEST_ARM64=$(basename $(ls /tmp/digests/digests-8.1-fpm-alpine-arm64/*)) echo "Digest AMD64: $DIGEST_AMD64" echo "Digest ARM64: $DIGEST_ARM64" From e8091e8c730cdbca5079c9d03c958d11dc65b87f Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 04:01:50 +0300 Subject: [PATCH 12/15] ci: changes --- .github/workflows/build.yml | 55 +++++++++++++++---------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 430e945..afc3aca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: os_name: ["alpine"] - php_version: ["8.1"] # , "8.2", "8.3" - php_type: ["fpm"] # , "cli", "supervisord" + php_version: ["8.1", "8.2", "8.3"] + php_type: ["fpm", "cli", "supervisord"] builder: [{arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] runs-on: ${{ matrix.builder.os }} steps: @@ -160,22 +160,6 @@ jobs: pattern: digests-* path: /tmp/digests - - name: Print downloaded bake meta files - run: | - echo "Listing /tmp directory contents:" - ls -lah /tmp - - - name: Print downloaded digest files - run: | - echo "Listing /tmp/digests directory contents:" - ls -lah /tmp/digests - - - name: Print downloaded digest files - run: | - echo "Listing /tmp/digests directory contents:" - ls -lah /tmp/digests/digests-8.1-fpm-alpine-amd64/ - ls -lah /tmp/digests/digests-8.1-fpm-alpine-arm64/ - - name: 🔑 Login to docker-hub uses: docker/login-action@v3 with: @@ -202,20 +186,25 @@ jobs: - name: 🚀 Create manifest list and push run: | - # Fetch digests for amd64 and arm64 architectures - DIGEST_AMD64=$(basename $(ls /tmp/digests/digests-8.1-fpm-alpine-amd64/*)) - DIGEST_ARM64=$(basename $(ls /tmp/digests/digests-8.1-fpm-alpine-arm64/*)) - echo "Digest AMD64: $DIGEST_AMD64" - echo "Digest ARM64: $DIGEST_ARM64" - - # Create the manifest list for Docker Hub - docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${DOCKER_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-8.1-fpm-alpine-amd64.json) \ - "${DOCKER_NAMESPACE}@sha256:${DIGEST_AMD64}" \ - "${DOCKER_NAMESPACE}@sha256:${DIGEST_ARM64}" - - # Create the manifest list for GHCR - docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${GHCR_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-8.1-fpm-alpine-amd64.json) \ - "${GHCR_NAMESPACE}@sha256:${DIGEST_AMD64}" \ - "${GHCR_NAMESPACE}@sha256:${DIGEST_ARM64}" + variants=($(ls bake-meta-*.json | sed -E 's/bake-meta-//; s/-amd64.json|-arm64.json//g' | sort -u)) + for variant in "${variants[@]}"; do + + # Fetch digests for amd64 and arm64 architectures + DIGEST_AMD64=$(basename $(ls /tmp/digests/digests-${variant}-amd64/*)) + DIGEST_ARM64=$(basename $(ls /tmp/digests/digests-${variant}-arm64/*)) + echo "Digest AMD64: $DIGEST_AMD64" + echo "Digest ARM64: $DIGEST_ARM64" + + # Create the manifest list for Docker Hub + docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${DOCKER_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-${variant}-amd64.json) \ + "${DOCKER_NAMESPACE}@sha256:${DIGEST_AMD64}" \ + "${DOCKER_NAMESPACE}@sha256:${DIGEST_ARM64}" + + # Create the manifest list for GHCR + docker buildx imagetools create $(jq -cr ".target.\"docker-metadata-action\".tags | map(select(startswith(\"${GHCR_NAMESPACE}\")) | \"-t \" + .) | join(\" \")" /tmp/bake-meta-${variant}-amd64.json) \ + "${GHCR_NAMESPACE}@sha256:${DIGEST_AMD64}" \ + "${GHCR_NAMESPACE}@sha256:${DIGEST_ARM64}" + + done ... From 8348a9cee895b4b4671dfa605563a5c1123de19b Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 04:07:44 +0300 Subject: [PATCH 13/15] chore: fix file path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afc3aca..a172e82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,7 @@ jobs: - name: 🚀 Create manifest list and push run: | - variants=($(ls bake-meta-*.json | sed -E 's/bake-meta-//; s/-amd64.json|-arm64.json//g' | sort -u)) + variants=($(ls /tmp/bake-meta-*.json | sed -E 's/bake-meta-//; s/-amd64.json|-arm64.json//g' | sort -u)) for variant in "${variants[@]}"; do # Fetch digests for amd64 and arm64 architectures From 39ae16300d76e1688f493fc6d28fe6dc1ed75675 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 04:12:31 +0300 Subject: [PATCH 14/15] chore: fix file path --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a172e82..96791c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -185,8 +185,9 @@ jobs: buildkitd-flags: "--debug" - name: 🚀 Create manifest list and push + working-directory: /tmp run: | - variants=($(ls /tmp/bake-meta-*.json | sed -E 's/bake-meta-//; s/-amd64.json|-arm64.json//g' | sort -u)) + variants=($(ls bake-meta-*.json | sed -E 's/bake-meta-//; s/-amd64.json|-arm64.json//g' | sort -u)) for variant in "${variants[@]}"; do # Fetch digests for amd64 and arm64 architectures From 3a03ae3ee0da2e926764ed4a5ee966e13329a2a2 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 6 Apr 2024 04:20:03 +0300 Subject: [PATCH 15/15] chore: fix file path --- .github/workflows/auto-merge-release.yaml | 3 +-- .github/workflows/build.yml | 4 ---- .github/workflows/shellcheck.yml | 3 +-- .github/workflows/test.yml | 7 +++---- .github/workflows/upload-assets.yml | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/auto-merge-release.yaml b/.github/workflows/auto-merge-release.yaml index 7c8456b..084a3e1 100644 --- a/.github/workflows/auto-merge-release.yaml +++ b/.github/workflows/auto-merge-release.yaml @@ -3,8 +3,7 @@ # https://github.com/peter-evans/enable-pull-request-automerge on: # yamllint disable-line rule:truthy - # pull_request: - workflow_dispatch: + pull_request: permissions: pull-requests: write diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96791c9..7aced63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,6 @@ on: # yamllint disable-line rule:truthy push: branches: - master - pull_request: - branches: - - master release: types: - released @@ -69,7 +66,6 @@ jobs: ${{ env.GHCR_NAMESPACE }} tags: | type=raw,event=branch,value=latest - type=ref,event=pr type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 4e6239f..d23d164 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,8 +1,7 @@ --- on: # yamllint disable-line rule:truthy - # pull_request: - workflow_dispatch: + pull_request: name: 🐞 Differential shell-check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c636d3c..06626cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,10 +5,9 @@ concurrency: cancel-in-progress: true on: - workflow_dispatch: -# pull_request: -# paths-ignore: -# - '**.md' + pull_request: + paths-ignore: + - '**.md' env: DOCKER_NAMESPACE: wayofdev/php-base diff --git a/.github/workflows/upload-assets.yml b/.github/workflows/upload-assets.yml index 2f18539..98fbbc3 100644 --- a/.github/workflows/upload-assets.yml +++ b/.github/workflows/upload-assets.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 📦 Check out the codebase - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@v4.1.1 - name: 🚀 Generate dist files run: make generate