From 4fcd1b835ee6d9b8c566339c42b63de2f50ca406 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:01:18 -0700 Subject: [PATCH 01/13] ci, feat - allow explicitly setting the container image but if it's not set, use podman, fall back to docker --- github-action/action.yml | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/github-action/action.yml b/github-action/action.yml index 15f52a0d..28e4e744 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -9,13 +9,43 @@ inputs: description: "tag for container image, i.e.: v5" default: "v5" required: true + CONTAINER_ENGINE: + description: "Optional: explicitly set container engine (docker/podman)" + required: false + runs: using: "composite" steps: + - name: Determine container engine + id: detect_engine + shell: bash + run: | + set -e + # Respect explicit override + if [[ -n "${{ inputs.CONTAINER_ENGINE }}" ]]; then + echo "engine=${{ inputs.CONTAINER_ENGINE }}" >> "$GITHUB_OUTPUT" + else + if command -v podman >/dev/null 2>&1; then + echo "engine=podman" >> "$GITHUB_OUTPUT" + elif command -v docker >/dev/null 2>&1; then + echo "engine=docker" >> "$GITHUB_OUTPUT" + else + echo "Neither podman nor docker found in PATH" >&2 + exit 1 + fi + fi + - name: Download pluto binary shell: bash run: | - podman pull ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }} - podman cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto + set -e + ENGINE="${{ steps.detect_engine.outputs.engine }}" + + # Pull image + "$ENGINE" pull "${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}" + + # Extract binary + # shellcheck disable=SC2046 + "$ENGINE" cp $("${ENGINE}" create --rm "${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}":/pluto) /usr/local/bin/pluto - pluto --help + /usr/local/bin/pluto --help \ No newline at end of file From b7bd6a1f459baf713304216bb127963b982959b6 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:11:01 -0700 Subject: [PATCH 02/13] fix - `docker cp` works differently _sigh_ --- github-action/action.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/github-action/action.yml b/github-action/action.yml index 28e4e744..4d534df2 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -40,12 +40,20 @@ runs: run: | set -e ENGINE="${{ steps.detect_engine.outputs.engine }}" + IMAGE="${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}" + DEST="/usr/local/bin/pluto" - # Pull image - "$ENGINE" pull "${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}" - - # Extract binary - # shellcheck disable=SC2046 - "$ENGINE" cp $("${ENGINE}" create --rm "${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}":/pluto) /usr/local/bin/pluto + if [[ "$ENGINE" == "podman" ]]; then + "$ENGINE" pull "$IMAGE" + "$ENGINE" cp $("${ENGINE}" create --rm "$IMAGE":/pluto) "$DEST" + elif [[ "$ENGINE" == "docker" ]]; then + "$ENGINE" pull "$IMAGE" + CID=$("$ENGINE" create "$IMAGE") + "$ENGINE" cp "$CID":/pluto "$DEST" + "$ENGINE" rm "$CID" + else + echo "Unknown engine: $ENGINE" >&2 + exit 2 + fi - /usr/local/bin/pluto --help \ No newline at end of file + "$DEST" --help From ec968f5d7381c562d79c92a95c5c826fc038aa58 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:16:01 -0700 Subject: [PATCH 03/13] Explicitly set `+x` I shouldn't need this? --- github-action/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-action/action.yml b/github-action/action.yml index 4d534df2..1ca0ae38 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -55,5 +55,5 @@ runs: echo "Unknown engine: $ENGINE" >&2 exit 2 fi - + chmod +x "$DEST" "$DEST" --help From a3f3cd20a08d57e448f3b8ff496fb59a3e55fa84 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:23:36 -0700 Subject: [PATCH 04/13] Add a test GHA flow faster iterations. I fucking hate debugging/testing GHA --- .github/workflows/test.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..bb649ef1 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,20 @@ +--- +name: Test Pluto DL +on: + workflow_dispatch: + +jobs: + integration-tests: + runs-on: ubuntu-latest + permissions: + # Required for workflows in private repositories + contents: read + steps: + ## + # Can't use this as is; required PODMAN + # See: https://github.com/FairwindsOps/pluto/issues/576https://github.com/FairwindsOps/pluto/issues/576 + ## + - name: Download Pluto + id: install-pluto + # uses: FairwindsOps/pluto/github-action@v5.22.2 + uses: kquinsland/pluto/github-action@add-docker-support-to-gha From e2abf3b512fa4f62967921d06282c34f6e0ca531 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:27:48 -0700 Subject: [PATCH 05/13] ugh --- github-action/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-action/action.yml b/github-action/action.yml index 1ca0ae38..76fbb22f 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -44,8 +44,8 @@ runs: DEST="/usr/local/bin/pluto" if [[ "$ENGINE" == "podman" ]]; then - "$ENGINE" pull "$IMAGE" - "$ENGINE" cp $("${ENGINE}" create --rm "$IMAGE":/pluto) "$DEST" + podman pull ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }} + podman cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto elif [[ "$ENGINE" == "docker" ]]; then "$ENGINE" pull "$IMAGE" CID=$("$ENGINE" create "$IMAGE") From 630e9584bda261b6e8f1f82dec89c5c02da687f3 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:29:00 -0700 Subject: [PATCH 06/13] swap back to sub --- github-action/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-action/action.yml b/github-action/action.yml index 76fbb22f..dab5d44e 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -44,7 +44,7 @@ runs: DEST="/usr/local/bin/pluto" if [[ "$ENGINE" == "podman" ]]; then - podman pull ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }} + "$ENGINE" pull "$IMAGE" podman cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto elif [[ "$ENGINE" == "docker" ]]; then "$ENGINE" pull "$IMAGE" From 6989e1e5c6106bc73dd8a4013f7deb0b914b78ff Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:30:02 -0700 Subject: [PATCH 07/13] more swap --- github-action/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-action/action.yml b/github-action/action.yml index dab5d44e..33e77038 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -45,7 +45,7 @@ runs: if [[ "$ENGINE" == "podman" ]]; then "$ENGINE" pull "$IMAGE" - podman cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto + "$ENGINE" cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto elif [[ "$ENGINE" == "docker" ]]; then "$ENGINE" pull "$IMAGE" CID=$("$ENGINE" create "$IMAGE") From 096b784bccde0cd04fda8e2d9ff83dd8a4cb1a63 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:32:17 -0700 Subject: [PATCH 08/13] one more sub _sigh_ --- github-action/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-action/action.yml b/github-action/action.yml index 33e77038..8159ae4d 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -45,7 +45,7 @@ runs: if [[ "$ENGINE" == "podman" ]]; then "$ENGINE" pull "$IMAGE" - "$ENGINE" cp $(podman create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto + "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto elif [[ "$ENGINE" == "docker" ]]; then "$ENGINE" pull "$IMAGE" CID=$("$ENGINE" create "$IMAGE") From 766b171336e6c5843c8ec1a3190eed65401069f7 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:33:12 -0700 Subject: [PATCH 09/13] now force docker as test --- .github/workflows/github-action-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-action-test.yml b/.github/workflows/github-action-test.yml index ec21f2a7..9a61329e 100644 --- a/.github/workflows/github-action-test.yml +++ b/.github/workflows/github-action-test.yml @@ -11,7 +11,9 @@ jobs: - name: Download pluto uses: ./github-action + with: + CONTAINER_ENGINE: docker - name: Pluto exists? run: | - pluto version \ No newline at end of file + pluto version From 7b9244c18fc96a04e04e7b2b77bd1c98ae9daae2 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 11:35:59 -0700 Subject: [PATCH 10/13] revert for a clen PR --- .github/workflows/github-action-test.yml | 4 +--- .github/workflows/test.yaml | 20 -------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/github-action-test.yml b/.github/workflows/github-action-test.yml index 9a61329e..ec21f2a7 100644 --- a/.github/workflows/github-action-test.yml +++ b/.github/workflows/github-action-test.yml @@ -11,9 +11,7 @@ jobs: - name: Download pluto uses: ./github-action - with: - CONTAINER_ENGINE: docker - name: Pluto exists? run: | - pluto version + pluto version \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index bb649ef1..00000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Test Pluto DL -on: - workflow_dispatch: - -jobs: - integration-tests: - runs-on: ubuntu-latest - permissions: - # Required for workflows in private repositories - contents: read - steps: - ## - # Can't use this as is; required PODMAN - # See: https://github.com/FairwindsOps/pluto/issues/576https://github.com/FairwindsOps/pluto/issues/576 - ## - - name: Download Pluto - id: install-pluto - # uses: FairwindsOps/pluto/github-action@v5.22.2 - uses: kquinsland/pluto/github-action@add-docker-support-to-gha From 0a9048dba7e29b2efcb28509d5200e28e98623a7 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 12:10:25 -0700 Subject: [PATCH 11/13] Double check that the engine actually matters Earlier I hit some issues with `docker cp`. Assert issue still presents --- github-action/action.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/github-action/action.yml b/github-action/action.yml index 8159ae4d..5a143c5e 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -43,17 +43,21 @@ runs: IMAGE="${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}" DEST="/usr/local/bin/pluto" - if [[ "$ENGINE" == "podman" ]]; then - "$ENGINE" pull "$IMAGE" - "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto - elif [[ "$ENGINE" == "docker" ]]; then - "$ENGINE" pull "$IMAGE" - CID=$("$ENGINE" create "$IMAGE") - "$ENGINE" cp "$CID":/pluto "$DEST" - "$ENGINE" rm "$CID" - else - echo "Unknown engine: $ENGINE" >&2 - exit 2 - fi + # Maybe the engine doesn't matter? + "$ENGINE" pull "$IMAGE" + "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto + + # if [[ "$ENGINE" == "podman" ]]; then + # "$ENGINE" pull "$IMAGE" + # "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto + # elif [[ "$ENGINE" == "docker" ]]; then + # "$ENGINE" pull "$IMAGE" + # CID=$("$ENGINE" create "$IMAGE") + # "$ENGINE" cp "$CID":/pluto "$DEST" + # "$ENGINE" rm "$CID" + # else + # echo "Unknown engine: $ENGINE" >&2 + # exit 2 + # fi chmod +x "$DEST" "$DEST" --help From 2b0d81483952006f5f4ef244ea7d85b0c3a18904 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 12:11:54 -0700 Subject: [PATCH 12/13] test, again --- .github/workflows/github-action-test.yml | 4 +++- github-action/action.yml | 14 +------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/github-action-test.yml b/.github/workflows/github-action-test.yml index ec21f2a7..9a61329e 100644 --- a/.github/workflows/github-action-test.yml +++ b/.github/workflows/github-action-test.yml @@ -11,7 +11,9 @@ jobs: - name: Download pluto uses: ./github-action + with: + CONTAINER_ENGINE: docker - name: Pluto exists? run: | - pluto version \ No newline at end of file + pluto version diff --git a/github-action/action.yml b/github-action/action.yml index 5a143c5e..0480da4b 100644 --- a/github-action/action.yml +++ b/github-action/action.yml @@ -43,21 +43,9 @@ runs: IMAGE="${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}" DEST="/usr/local/bin/pluto" - # Maybe the engine doesn't matter? + echo "Using container engine: $ENGINE to pull image: $IMAGE" "$ENGINE" pull "$IMAGE" "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto - # if [[ "$ENGINE" == "podman" ]]; then - # "$ENGINE" pull "$IMAGE" - # "$ENGINE" cp $($ENGINE create --rm ${{ inputs.IMAGE_PULL_URL }}:${{ inputs.IMAGE_TAG }}):/pluto /usr/local/bin/pluto - # elif [[ "$ENGINE" == "docker" ]]; then - # "$ENGINE" pull "$IMAGE" - # CID=$("$ENGINE" create "$IMAGE") - # "$ENGINE" cp "$CID":/pluto "$DEST" - # "$ENGINE" rm "$CID" - # else - # echo "Unknown engine: $ENGINE" >&2 - # exit 2 - # fi chmod +x "$DEST" "$DEST" --help From a76829fed361b6871ce6d68232ee066f74b07553 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Mon, 4 Aug 2025 12:13:10 -0700 Subject: [PATCH 13/13] revert test --- .github/workflows/github-action-test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/github-action-test.yml b/.github/workflows/github-action-test.yml index 9a61329e..ec21f2a7 100644 --- a/.github/workflows/github-action-test.yml +++ b/.github/workflows/github-action-test.yml @@ -11,9 +11,7 @@ jobs: - name: Download pluto uses: ./github-action - with: - CONTAINER_ENGINE: docker - name: Pluto exists? run: | - pluto version + pluto version \ No newline at end of file