Compare commits

..

24 commits
v2.5.1 ... main

Author SHA1 Message Date
divyansh42
5ed88d269c Add changelog
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2024-03-08 12:10:55 +05:30
divyansh42
7d220213a5 Add input-output generate scripts
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2024-03-05 19:22:27 +05:30
EusebioTrigo
0fa2dca2e8
Support/node20 (#93)
* Update action.yml to use node20

* Update README.md with newer runner versions and fix typo

* Update all workflows to use newer action versions and runner environments
2024-03-05 19:18:07 +05:30
Divyanshu Agrawal
e85426e5e2
Update dependency (#94)
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2024-03-05 18:00:50 +05:30
divyansh42
ded55cf56a Disable crda scan workflow temporarily
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2024-03-05 17:27:37 +05:30
dependabot[bot]
eaa95b72b2
Bump word-wrap from 1.2.3 to 1.2.4 (#87)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 17:24:39 +05:30
divyansh42
9986a6552b Add changelog for v2.7.1
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2023-02-15 17:54:39 +05:30
Philipp Trulson
7c03c8a51b
Don't add docker.io prefix to ECR images (#69) 2023-02-15 17:51:30 +05:30
dependabot[bot]
66a554d6f9
Bump json5 from 1.0.1 to 1.0.2 (#83)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 17:41:43 +05:30
divyansh42
9e8327fcde Add changelog for v2.7
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-12-29 18:50:56 +05:30
Dominick Gendill
8b69cb8d8b Update action to node16 2022-12-23 21:04:05 +05:30
divyansh42
3f429b2fec Update bundle
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-11-22 15:41:12 +05:30
dependabot[bot]
1d4d173244
Bump glob-parent from 5.1.1 to 5.1.2 (#82)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:37:54 +05:30
dependabot[bot]
24868e45f3
Bump lodash from 4.17.20 to 4.17.21 (#81)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:37:30 +05:30
dependabot[bot]
69e294eb20
Bump ansi-regex from 5.0.0 to 5.0.1 (#80)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:37:11 +05:30
dependabot[bot]
bdd3fe419c
Bump path-parse from 1.0.6 to 1.0.7 (#79)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:37:00 +05:30
dependabot[bot]
167752053d
Bump minimist from 1.2.5 to 1.2.7 (#78)
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:36:45 +05:30
dependabot[bot]
1eb06d6198
Bump minimatch from 3.0.4 to 3.1.2 (#77)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:36:30 +05:30
dependabot[bot]
5bcdca892e
Bump @actions/core from 1.2.6 to 1.9.1 (#76)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.6 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 14:36:16 +05:30
divyansh42
df878026e3 Add changelog for v2.6
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-06-02 16:51:54 +05:30
Divyanshu Agrawal
287d78ef6b
Remove kubic repositories (#65)
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-06-02 16:45:17 +05:30
Al S
ac5a9d0fd8
Check and enforce lowercasing of registry and image refs. (#56) 2022-06-02 16:44:33 +05:30
divyansh42
7e7aa10ef2 Disable link checker for GitHub docks links
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-05-04 09:26:39 +05:30
Divyanshu Agrawal
c24e5a78b1
Add CRDA scan workflow (#63)
Signed-off-by: divyansh42 <diagrawa@redhat.com>
2022-03-10 18:54:18 +05:30
21 changed files with 2673 additions and 5365 deletions

View file

@ -1,7 +1,3 @@
# https://podman.io/getting-started/installation
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update sudo apt-get update
sudo apt-get -y upgrade sudo apt-get -y upgrade
sudo apt-get -y install podman sudo apt-get -y install podman

65
.github/workflows/check-lowercase.yaml vendored Normal file
View file

@ -0,0 +1,65 @@
# This workflow will perform a test whenever there
# is some change in code done to ensure that the changes
# are not buggy and we are getting the desired output.
name: Check Case Normalization
on:
push:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # every day at midnight
env:
IMAGE_NAME: ImageCaseTest
IMAGE_TAGS: v1 TagCaseTest ${{ github.sha }}
IMAGE_REGISTRY: Ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
push-ghcr:
name: Build and push image
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
install_latest: [ true, false ]
steps:
# Checkout push-to-registry action github repository
- name: Checkout Push to Registry action
uses: actions/checkout@v4
- name: Install latest podman
if: matrix.install_latest
run: |
bash .github/install_latest_podman.sh
# Build image using Buildah action
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAGS }}
base-image: busybox:latest
entrypoint: |
bash
-c
echo 'hello world'
oci: true
# Push the image to GHCR (Image Registry)
- name: Push To GHCR
uses: ./
id: push
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
- name: Echo outputs
run: |
echo "${{ toJSON(steps.push.outputs) }}"

View file

@ -9,18 +9,18 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- run: npm ci - run: npm ci
- run: npm run lint - run: npm run lint
check-dist: check-dist:
name: Check Distribution name: Check Distribution
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env: env:
BUNDLE_FILE: "dist/index.js" BUNDLE_FILE: "dist/index.js"
BUNDLE_COMMAND: "npm run bundle" BUNDLE_COMMAND: "npm run bundle"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Install - name: Install
run: npm ci run: npm ci
@ -33,11 +33,11 @@ jobs:
check-inputs-outputs: check-inputs-outputs:
name: Check Input and Output enums name: Check Input and Output enums
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env: env:
IO_FILE: ./src/generated/inputs-outputs.ts IO_FILE: ./src/generated/inputs-outputs.ts
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

View file

@ -17,7 +17,7 @@ env:
jobs: jobs:
push-ghcr: push-ghcr:
name: Build and push image name: Build and push image
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -26,7 +26,7 @@ jobs:
steps: steps:
# Checkout push-to-registry action github repository # Checkout push-to-registry action github repository
- name: Checkout Push to Registry action - name: Checkout Push to Registry action
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install latest podman - name: Install latest podman
if: matrix.install_latest if: matrix.install_latest

View file

@ -12,9 +12,9 @@ on:
jobs: jobs:
markdown-link-check: markdown-link-check:
name: Check links in markdown name: Check links in markdown
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1 - uses: gaurav-nelson/github-action-markdown-link-check@v1
with: with:
use-verbose-mode: true use-verbose-mode: true

View file

@ -17,7 +17,7 @@ env:
jobs: jobs:
push-quay: push-quay:
name: Build and push manifest name: Build and push manifest
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -26,7 +26,7 @@ jobs:
steps: steps:
# Checkout push-to-registry action github repository # Checkout push-to-registry action github repository
- name: Checkout Push to Registry action - name: Checkout Push to Registry action
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install latest podman - name: Install latest podman
if: matrix.install_latest if: matrix.install_latest
@ -51,7 +51,7 @@ jobs:
- name: Build Image - name: Build Image
id: build_image id: build_image
uses: redhat-actions/buildah-build@main uses: redhat-actions/buildah-build@v2
with: with:
image: ${{ env.IMAGE_NAME }} image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAGS }} tags: ${{ env.IMAGE_TAGS }}

View file

@ -17,7 +17,7 @@ jobs:
build: build:
name: |- name: |-
Build with ${{ matrix.build_with }} and push${{ matrix.fully_qualified_image_name_tag && ' FQIN' || '' }} (latest: ${{ matrix.install_latest }}) Build with ${{ matrix.build_with }} and push${{ matrix.fully_qualified_image_name_tag && ' FQIN' || '' }} (latest: ${{ matrix.install_latest }})
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -29,7 +29,7 @@ jobs:
# Checkout push-to-registry action github repository # Checkout push-to-registry action github repository
- name: Checkout Push to Registry action - name: Checkout Push to Registry action
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install latest podman - name: Install latest podman
if: matrix.install_latest if: matrix.install_latest

View file

@ -17,7 +17,7 @@ env:
jobs: jobs:
push-quay: push-quay:
name: Build and push image name: Build and push image
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -26,7 +26,7 @@ jobs:
steps: steps:
# Checkout push-to-registry action github repository # Checkout push-to-registry action github repository
- name: Checkout Push to Registry action - name: Checkout Push to Registry action
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install latest podman - name: Install latest podman
if: matrix.install_latest if: matrix.install_latest

35
.github/workflows/security_scan.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Vulnerability Scan with CRDA
on:
# push:
workflow_dispatch:
# pull_request_target:
# types: [ assigned, opened, synchronize, reopened, labeled, edited ]
# schedule:
# - cron: '0 0 * * *' # every day at midnight
jobs:
crda-scan:
runs-on: ubuntu-22.04
name: Scan project vulnerability with CRDA
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install CRDA
uses: redhat-actions/openshift-tools-installer@v1
with:
source: github
github_pat: ${{ github.token }}
crda: "latest"
- name: CRDA Scan
id: scan
uses: redhat-actions/crda@v1
with:
crda_key: ${{ secrets.CRDA_KEY }}
fail_on: never

View file

@ -17,7 +17,7 @@ env:
jobs: jobs:
login-and-push: login-and-push:
name: Login and push image to Quay.io name: Login and push image to Quay.io
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -27,7 +27,7 @@ jobs:
# Checkout push-to-registry action github repository # Checkout push-to-registry action github repository
- name: Checkout Push to Registry action - name: Checkout Push to Registry action
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install latest podman - name: Install latest podman
if: matrix.install_latest if: matrix.install_latest

View file

@ -1,5 +1,18 @@
# push-to-registry Changelog # push-to-registry Changelog
## v2.8
- Update action to run on Node20. https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
## v2.7.1
- Don't add docker.io prefix to ECR images. [#69](https://github.com/redhat-actions/push-to-registry/pull/69)
## v2.7
- Update action to run on Node16. https://github.blog/changelog/2022-05-20-actions-can-now-run-in-a-node-js-16-runtime/
## v2.6
- Make image and tag in lowercase, if found in uppercase. https://github.com/redhat-actions/push-to-registry/issues/54
- Remove kubic packages from the test workflows. https://github.com/redhat-actions/buildah-build/issues/93
## v2.5.1 ## v2.5.1
- README update - README update

View file

@ -101,10 +101,10 @@ on: [ push ]
jobs: jobs:
build: build:
name: Build and push image name: Build and push image
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Build Image - name: Build Image
id: build-image id: build-image
@ -130,7 +130,7 @@ jobs:
- name: Print image url - name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
``` ```
<!-- markdown-link-check-disable-next-line -->
Refer to [GHCR push example](./.github/workflows/ghcr-push.yaml) for complete example of push to [GitHub Container Registry (GHCR)](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry). Refer to [GHCR push example](./.github/workflows/ghcr-push.yaml) for complete example of push to [GitHub Container Registry (GHCR)](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
## Note about images built with Docker ## Note about images built with Docker
@ -144,13 +144,13 @@ If the image to push is present in both the Docker and Podman image storage, the
If the action pulled an image from the Docker image storage into the Podman storage, it will be cleaned up from the Podman storage before the action exits. If the action pulled an image from the Docker image storage into the Podman storage, it will be cleaned up from the Podman storage before the action exits.
## Note about GitHub runners and Podman ## Note about GitHub runners and Podman
We recommend using `runs-on: ubuntu-20.04` since it has a newer version of Podman. We recommend using `runs-on: ubuntu-22.04` since it has a newer version of Podman.
If you are on `ubuntu-18.04` or any other older versions of ubuntu your workflow will use an older version of Podman and may encounter issues such as [#26](https://github.com/redhat-actions/push-to-registry/issues/26). If you are on `ubuntu-20.04` or any other older versions of ubuntu your workflow will use an older version of Podman and may encounter issues such as [#26](https://github.com/redhat-actions/push-to-registry/issues/26).
## Troubleshooting ## Troubleshooting
Note that quay.io repositories are private by default.<br> Note that quay.io repositories are private by default.<br>
This means that if you push an image for the first time, you will have to authenticate before pulling it, or go to the repository's settings and change its visibility. This means that if you push an image for the first time, you will have to authenticate before pulling it, or go to the repository's settings and change its visibility.
Simiarly, if you receive a 403 Forbidden from GHCR, you may have to update the Package Settings. Refer to [this issue](https://github.com/redhat-actions/push-to-registry/issues/52). Similarly, if you receive a 403 Forbidden from GHCR, you may have to update the Package Settings. Refer to [this issue](https://github.com/redhat-actions/push-to-registry/issues/52).

View file

@ -11,7 +11,7 @@ inputs:
tags: tags:
description: | description: |
'The tag or tags of the image/manifest to push. 'The tag or tags of the image/manifest to push.
For multiple tags, seperate by whitespace. For example, "latest v1"' For multiple tags, separate by whitespace. For example, "latest v1"'
required: false required: false
default: 'latest' default: 'latest'
registry: registry:
@ -47,5 +47,5 @@ outputs:
registry-paths: registry-paths:
description: 'A JSON array of registry paths to which the tag(s) were pushed' description: 'A JSON array of registry paths to which the tag(s) were pushed'
runs: runs:
using: 'node12' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'

4
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3867
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "push-to-registry", "name": "push-to-registry",
"version": "0.0.1", "version": "2.0.0",
"description": "Action to push images to registry", "description": "Action to push images to registry",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -8,26 +8,27 @@
"bundle": "ncc build src/index.ts --source-map --minify", "bundle": "ncc build src/index.ts --source-map --minify",
"clean": "rm -rf out/ dist/", "clean": "rm -rf out/ dist/",
"lint": "eslint . --max-warnings=0", "lint": "eslint . --max-warnings=0",
"generate-ios": "npx action-io-generator -w -o ./src/generated/inputs-outputs.ts",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Red Hat", "author": "Red Hat",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.10.1",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.1.3",
"ini": "^2.0.0" "ini": "^4.1.2"
}, },
"devDependencies": { "devDependencies": {
"@redhat-actions/action-io-generator": "^1.5.0", "@redhat-actions/action-io-generator": "^1.5.0",
"@redhat-actions/eslint-config": "^1.3.2", "@redhat-actions/eslint-config": "^1.3.2",
"@redhat-actions/tsconfig": "^1.1.1", "@redhat-actions/tsconfig": "^1.2.0",
"@types/ini": "^1.3.30", "@types/ini": "^4.1.0",
"@types/node": "^12.12.7", "@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^4.22.0", "@typescript-eslint/parser": "^7.1.1",
"@vercel/ncc": "^0.25.1", "@vercel/ncc": "^0.38.1",
"eslint": "^7.18.0", "eslint": "^8.57.0",
"typescript": "^4.0.5" "typescript": "5.3"
} }
} }

View file

@ -35,7 +35,7 @@ export enum Inputs {
REGISTRY = "registry", REGISTRY = "registry",
/** /**
* 'The tag or tags of the image/manifest to push. * 'The tag or tags of the image/manifest to push.
* For multiple tags, seperate by whitespace. For example, "latest v1"' * For multiple tags, separate by whitespace. For example, "latest v1"'
* Required: false * Required: false
* Default: "latest" * Default: "latest"
*/ */

View file

@ -43,7 +43,7 @@ async function getPodmanPath(): Promise<string> {
async function run(): Promise<void> { async function run(): Promise<void> {
const DEFAULT_TAG = "latest"; const DEFAULT_TAG = "latest";
const imageInput = core.getInput(Inputs.IMAGE); const image = core.getInput(Inputs.IMAGE);
const tags = core.getInput(Inputs.TAGS); const tags = core.getInput(Inputs.TAGS);
// split tags // split tags
const tagsList = tags.trim().split(/\s+/); const tagsList = tags.trim().split(/\s+/);
@ -53,6 +53,21 @@ async function run(): Promise<void> {
core.info(`Input "${Inputs.TAGS}" is not provided, using default tag "${DEFAULT_TAG}"`); core.info(`Input "${Inputs.TAGS}" is not provided, using default tag "${DEFAULT_TAG}"`);
tagsList.push(DEFAULT_TAG); tagsList.push(DEFAULT_TAG);
} }
const normalizedTagsList: string[] = [];
let isNormalized = false;
for (const tag of tagsList) {
normalizedTagsList.push(tag.toLowerCase());
if (tag.toLowerCase() !== tag) {
isNormalized = true;
}
}
const normalizedImage = image.toLowerCase();
if (isNormalized || image !== normalizedImage) {
core.warning(`Reference to image and/or tag must be lowercase.`
+ ` Reference has been converted to be compliant with standard.`);
}
const registry = core.getInput(Inputs.REGISTRY); const registry = core.getInput(Inputs.REGISTRY);
const username = core.getInput(Inputs.USERNAME); const username = core.getInput(Inputs.USERNAME);
const password = core.getInput(Inputs.PASSWORD); const password = core.getInput(Inputs.PASSWORD);
@ -60,12 +75,12 @@ async function run(): Promise<void> {
const digestFileInput = core.getInput(Inputs.DIGESTFILE); const digestFileInput = core.getInput(Inputs.DIGESTFILE);
// check if all tags provided are in `image:tag` format // check if all tags provided are in `image:tag` format
const isFullImageNameTag = isFullImageName(tagsList[0]); const isFullImageNameTag = isFullImageName(normalizedTagsList[0]);
if (tagsList.some((tag) => isFullImageName(tag) !== isFullImageNameTag)) { if (normalizedTagsList.some((tag) => isFullImageName(tag) !== isFullImageNameTag)) {
throw new Error(`Input "${Inputs.TAGS}" cannot have a mix of full name and non full name tags`); throw new Error(`Input "${Inputs.TAGS}" cannot have a mix of full name and non full name tags`);
} }
if (!isFullImageNameTag) { if (!isFullImageNameTag) {
if (!imageInput) { if (!normalizedImage) {
throw new Error(`Input "${Inputs.IMAGE}" must be provided when using non full name tags`); throw new Error(`Input "${Inputs.IMAGE}" must be provided when using non full name tags`);
} }
if (!registry) { if (!registry) {
@ -73,28 +88,28 @@ async function run(): Promise<void> {
} }
const registryWithoutTrailingSlash = registry.replace(/\/$/, ""); const registryWithoutTrailingSlash = registry.replace(/\/$/, "");
const registryPath = `${registryWithoutTrailingSlash}/${imageInput}`; const registryPath = `${registryWithoutTrailingSlash}/${normalizedImage}`;
core.info(`Combining image name "${imageInput}" and registry "${registry}" ` core.info(`Combining image name "${normalizedImage}" and registry "${registry}" `
+ `to form registry path "${registryPath}"`); + `to form registry path "${registryPath}"`);
if (imageInput.indexOf("/") > -1 && registry.indexOf("/") > -1) { if (normalizedImage.indexOf("/") > -1 && registry.indexOf("/") > -1) {
core.warning(`"${registryPath}" does not seem to be a valid registry path. ` core.warning(`"${registryPath}" does not seem to be a valid registry path. `
+ `The registry path should not contain more than 2 slashes. ` + `The registry path should not contain more than 2 slashes. `
+ `Refer to the Inputs section of the readme for naming image and registry.`); + `Refer to the Inputs section of the readme for naming image and registry.`);
} }
sourceImages = tagsList.map((tag) => getFullImageName(imageInput, tag)); sourceImages = normalizedTagsList.map((tag) => getFullImageName(normalizedImage, tag));
destinationImages = tagsList.map((tag) => getFullImageName(registryPath, tag)); destinationImages = normalizedTagsList.map((tag) => getFullImageName(registryPath, tag));
} }
else { else {
if (imageInput) { if (normalizedImage) {
core.warning(`Input "${Inputs.IMAGE}" is ignored when using full name tags`); core.warning(`Input "${Inputs.IMAGE}" is ignored when using full name tags`);
} }
if (registry) { if (registry) {
core.warning(`Input "${Inputs.REGISTRY}" is ignored when using full name tags`); core.warning(`Input "${Inputs.REGISTRY}" is ignored when using full name tags`);
} }
sourceImages = tagsList; sourceImages = normalizedTagsList;
destinationImages = tagsList; destinationImages = normalizedTagsList;
} }
const inputExtraArgsStr = core.getInput(Inputs.EXTRA_ARGS); const inputExtraArgsStr = core.getInput(Inputs.EXTRA_ARGS);
@ -157,8 +172,8 @@ async function run(): Promise<void> {
); );
} }
const allTagsinPodman: boolean = podmanFoundTags.length === tagsList.length; const allTagsinPodman: boolean = podmanFoundTags.length === normalizedTagsList.length;
const allTagsinDocker: boolean = dockerFoundTags.length === tagsList.length; const allTagsinDocker: boolean = dockerFoundTags.length === normalizedTagsList.length;
if (allTagsinPodman && allTagsinDocker) { if (allTagsinPodman && allTagsinDocker) {
const isPodmanImageLatest = await isPodmanLocalImageLatest(); const isPodmanImageLatest = await isPodmanLocalImageLatest();
@ -295,7 +310,9 @@ async function pullImageFromDocker(): Promise<ImageStorageCheckResult> {
} }
} }
catch (err) { catch (err) {
core.warning(err); if (err instanceof Error) {
core.debug(err.message);
}
} }
return { return {
@ -325,7 +342,9 @@ async function checkImageInPodman(): Promise<ImageStorageCheckResult> {
} }
} }
catch (err) { catch (err) {
core.debug(err); if (err instanceof Error) {
core.debug(err.message);
}
} }
return { return {

View file

@ -54,7 +54,9 @@ export async function findFuseOverlayfsPath(): Promise<string | undefined> {
fuseOverlayfsPath = await io.which("fuse-overlayfs"); fuseOverlayfsPath = await io.which("fuse-overlayfs");
} }
catch (err) { catch (err) {
core.debug(err); if (err instanceof Error) {
core.debug(err.message);
}
} }
return fuseOverlayfsPath; return fuseOverlayfsPath;
@ -83,6 +85,7 @@ export function getFullDockerImageName(image: string): string {
case 1: case 1:
return `${DOCKER_IO_NAMESPACED}/${image}`; return `${DOCKER_IO_NAMESPACED}/${image}`;
case 2: case 2:
if (image.includes("amazonaws.com")) return image;
return `${DOCKER_IO}/${image}`; return `${DOCKER_IO}/${image}`;
default: default:
return image; return image;