From 8060274e8f65b506f68df4c3f0beac7e9888f687 Mon Sep 17 00:00:00 2001 From: s3lph Date: Mon, 4 Dec 2023 21:13:50 +0100 Subject: [PATCH 1/8] feat: add license --- LICENSE | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..39629a2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,10 @@ +MIT License + +Copyright (c) 2023 s3lph + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + From 43c892c45f1f858cda98c549056eb352816932aa Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 12:19:40 -0300 Subject: [PATCH 2/8] feat: add docker hub as default registry --- .vscode/settings.json | 3 +++ action.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c60674c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["elif", "kaniko"] +} diff --git a/action.yml b/action.yml index 3d61d87..5d351e8 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,4 @@ --- - name: Kaniko description: Build a container image using Kaniko inputs: @@ -11,7 +10,8 @@ inputs: required: true registry: description: Domain of the registry. Should be the same as the first path component of the tag. - required: true + required: false + default: https://index.docker.io/v1/ username: description: Username for the container registry required: true From 4496efe737a64d24087e12f04d7d9573032b8e15 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 12:20:18 -0300 Subject: [PATCH 3/8] feat: read Dockerfile from local file system --- action.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 5d351e8..04c5a8c 100644 --- a/action.yml +++ b/action.yml @@ -2,9 +2,9 @@ name: Kaniko description: Build a container image using Kaniko inputs: - Dockerfile: + dockerfile: description: The Dockerfile to pass to Kaniko - required: true + required: false image: description: Name and tag under which to upload the image required: true @@ -27,7 +27,15 @@ runs: - | mkdir -p /kaniko/.docker echo '{"auths":{"${{ inputs.registry }}":{"auth":"'$(printf "%s:%s" "${{ inputs.username }}" "${{ inputs.password }}" | base64 | tr -d '\n')'"}}}' > /kaniko/.docker/config.json - cat > Dockerfile < Dockerfile + elif [ -f "./Dockerfile" ]; then + echo "Using existing ./Dockerfile from workspace" + else + echo "ERROR: No Dockerfile provided and no ./Dockerfile found in workspace" + exit 1 + fi + + /kaniko/executor --dockerfile Dockerfile --destination "${{ inputs.image }}" From dffa17475a42a7f02644dc2420bddb9165ffeb30 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 13:13:59 -0300 Subject: [PATCH 4/8] feat: set kaniko context to github workspace folder --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 04c5a8c..bc99544 100644 --- a/action.yml +++ b/action.yml @@ -38,4 +38,4 @@ runs: exit 1 fi - /kaniko/executor --dockerfile Dockerfile --destination "${{ inputs.image }}" + /kaniko/executor --dockerfile Dockerfile --context $GITHUB_WORKSPACE --destination "${{ inputs.image }}" From b0857dcff7add0cacf7dc798546fea2bef64eb18 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 13:22:52 -0300 Subject: [PATCH 5/8] feat: support multiple destinations --- action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index bc99544..ccccb16 100644 --- a/action.yml +++ b/action.yml @@ -38,4 +38,11 @@ runs: exit 1 fi - /kaniko/executor --dockerfile Dockerfile --context $GITHUB_WORKSPACE --destination "${{ inputs.image }}" + dest_flags="" + for dest in $(echo "${{ inputs.image }}" | tr ',' ' '); do + dest_flags="$dest_flags --destination=$dest" + done + + echo "Destinations: $dest_flags" + + /kaniko/executor --dockerfile Dockerfile --context $GITHUB_WORKSPACE $dest_flags From e3c4b9878e0a35594bbf6c33d5d73f2a14273a9e Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 13:25:23 -0300 Subject: [PATCH 6/8] chore: add multi tag example --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18e8ba3..00586f4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Build OCI images using Kaniko, with the Dockerfile contents provided directly as ## Usage -Example: +### Example: Basic Usage, all options. ```yaml jobs: @@ -21,3 +21,17 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} ``` + +### Example: Multiple Tags, Default registry + +```yaml +jobs: + cowsay: + runs-on: docker + steps: + - uses: https://git.kabelsalat.ch/s3lph/forgejo-kaniko-action@v1 + with: + image: my-user/test-image:latest,my-user/test-image:${{ github.sha }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} +``` From 7589c04e3ff19acf05214ceb811743427e0466b9 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 13:51:39 -0300 Subject: [PATCH 7/8] chore: rename action --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 00586f4..ca5fbd8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ jobs: cowsay: runs-on: docker steps: - - uses: https://git.kabelsalat.ch/s3lph/forgejo-kaniko-action@v1 + - uses: https://github.com/leandro-costa-oliveira/forgejo-kaniko-action@v2 with: image: my-user/test-image:latest,my-user/test-image:${{ github.sha }} username: ${{ secrets.REGISTRY_USERNAME }} diff --git a/action.yml b/action.yml index ccccb16..45de604 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ --- -name: Kaniko +name: Forgejo Kaniko description: Build a container image using Kaniko inputs: dockerfile: From 8ba1608afe5dc7fb168153bd226a89ce277d9dbf Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Tue, 17 Jun 2025 14:14:20 -0300 Subject: [PATCH 8/8] chore: add credits --- README.md | 7 ++++++- action.yml | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ca5fbd8..c3a7b04 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Kaniko Action -Build OCI images using Kaniko, with the Dockerfile contents provided directly as an action input. +Build OCI images using Kaniko. ## Usage @@ -35,3 +35,8 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} ``` + +### Credits + +Original creator of the action v1: +https://git.kabelsalat.ch/s3lph/forgejo-kaniko-action diff --git a/action.yml b/action.yml index 45de604..6856f9f 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,9 @@ --- name: Forgejo Kaniko description: Build a container image using Kaniko +branding: + icon: anchor + color: blue inputs: dockerfile: description: The Dockerfile to pass to Kaniko