Warn user if input image and registry both have / (#39)

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
Divyanshu Agrawal 2021-04-22 21:57:32 +05:30 committed by GitHub
parent 6a46770abc
commit 984901b4bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 260 additions and 123 deletions

View file

@ -5,7 +5,7 @@ on:
- '**.md' - '**.md'
pull_request: pull_request:
paths: paths:
-'**.md' - '**.md'
schedule: schedule:
- cron: '0 0 * * *' # every day at midnight - cron: '0 0 * * *' # every day at midnight

View file

@ -9,6 +9,7 @@ env:
IMAGE_NAME: myimage IMAGE_NAME: myimage
IMAGE_TAG: v1 IMAGE_TAG: v1
IMAGE_REGISTRY: quay.io IMAGE_REGISTRY: quay.io
STORAGE_OPTS: "overlay.mount_program=/usr/bin/fuse-overlayfs"
jobs: jobs:
build-only-podman: build-only-podman:

View file

@ -22,15 +22,17 @@ Refer to the [`podman push`](http://docs.podman.io/en/latest/markdown/podman-man
| Input Name | Description | Default | | Input Name | Description | Default |
| ---------- | ----------- | ------- | | ---------- | ----------- | ------- |
| image | Name of the image you want to push. | **Required** | image | Name of the image you want to push. Eg. `username/imagename` or `imagename`. See the note below about naming image and registry. | **Required**
| tags | The tag or tags of the image to push. For multiple tags, separate by a space. For example, `latest ${{ github.sha }}`. | `latest` | tags | The tag or tags of the image to push. For multiple tags, separate by a space. For example, `latest ${{ github.sha }}`. | `latest`
| registry | URL of the registry to push the image to. Eg. `quay.io/<username>` | **Required** | registry | Hostname and optional namespace to push the image to. Eg. `quay.io` or `quay.io/username`. See the note below about naming image and registry. | **Required**
| username | Username with which to authenticate to the registry. Required unless already logged in to the registry. | None | username | Username with which to authenticate to the registry. Required unless already logged in to the registry. | None
| password | Password, encrypted password, or access token to use to log in to the registry. Required unless already logged in to the registry. | None | password | Password, encrypted password, or access token to use to log in to the registry. Required unless already logged in to the registry. | None
| tls-verify | Verify TLS certificates when contacting the registry. Set to `false` to skip certificate verification. | `true` | tls-verify | Verify TLS certificates when contacting the registry. Set to `false` to skip certificate verification. | `true`
| digestfile | After copying the image, write the digest of the resulting image to the file. The contents of this file are the digest output. | Auto-generated from image and tag | digestfile | After copying the image, write the digest of the resulting image to the file. The contents of this file are the digest output. | Auto-generated from image and tag
| extra-args | Extra args to be passed to podman push. Separate arguments by newline. Do not use quotes. | None | extra-args | Extra args to be passed to podman push. Separate arguments by newline. Do not use quotes. | None
**NOTE**: You can provide the registry namespace (usually your username, or organization) either as a suffix to input `registry` (eg. `quay.io/username`) or as a prefix to input `image` (eg. `username/myimage`), but not in both. The full image path will be resolved from `<registry>/<image>`.
## Action Outputs ## Action Outputs
`digest`: The pushed image digest, as written to the `digestfile`.<br> `digest`: The pushed image digest, as written to the `digestfile`.<br>

View file

@ -6,14 +6,14 @@ branding:
color: red color: red
inputs: inputs:
image: image:
description: 'Name of the image to push' description: 'Name of the image to push (e.g. username/imagename or imagename)'
required: true required: true
tags: tags:
description: 'The tag or tags of the image to push. For multiple tags, seperate by a space. For example, "latest v1"' description: 'The tag or tags of the image to push. For multiple tags, seperate by a space. For example, "latest v1"'
required: false required: false
default: 'latest' default: 'latest'
registry: registry:
description: 'Registry where to push the image (eg. quay.io/username)' description: 'Hostname and optional namespace to push the image to (eg. quay.io/username or quay.io)'
required: true required: true
username: username:
description: 'Username to use as credential to authenticate to the registry' description: 'Username to use as credential to authenticate to the registry'

2
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

313
package-lock.json generated
View file

@ -124,9 +124,9 @@
} }
}, },
"@redhat-actions/eslint-config": { "@redhat-actions/eslint-config": {
"version": "1.2.11", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.2.11.tgz", "resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.3.2.tgz",
"integrity": "sha512-hS8XXkpWu32Z3S6+EFAvD32+QruxyLiSfqrXjkaSLtWZndkJLNZ/xpHcEwRM1u7KJzd1f7jPl46+GLFfrPT8RQ==", "integrity": "sha512-v4KM00RIimRiNjZStOLjzo1kDpLuVDDlNPJ9lZqsR5ZGZI13dnnXWGpxAk7eD1ZtiztEs+ogN0wOzOxsEFa8iw==",
"dev": true, "dev": true,
"requires": { "requires": {
"eslint-config-airbnb-base": ">= 14", "eslint-config-airbnb-base": ">= 14",
@ -134,9 +134,9 @@
} }
}, },
"@redhat-actions/tsconfig": { "@redhat-actions/tsconfig": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@redhat-actions/tsconfig/-/tsconfig-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@redhat-actions/tsconfig/-/tsconfig-1.1.1.tgz",
"integrity": "sha512-9eiU6lLepYIO/h51F8bph2KI4/ZdqK0inDcoOtaBGfQslsoSRygaTmRwD6EaejcDTor/5MZZo9dIKmm+5BGkXw==", "integrity": "sha512-t+i85G2LLauDOlH3MQqxVblCKMt5yyRHZsO7NoVKE8T1W1aIosH1bs5xH2RqwXaWw2Si+r66W/tuHRQzKbR51w==",
"dev": true "dev": true
}, },
"@types/json-schema": { "@types/json-schema": {
@ -158,86 +158,156 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.0.tgz",
"integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==", "integrity": "sha512-U8SP9VOs275iDXaL08Ln1Fa/wLXfj5aTr/1c0t0j6CdbOnxh+TruXu1p4I0NAvdPBQgoPjHsgKn28mOi0FzfoA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "4.14.1", "@typescript-eslint/experimental-utils": "4.22.0",
"@typescript-eslint/scope-manager": "4.14.1", "@typescript-eslint/scope-manager": "4.22.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"regexpp": "^3.0.0", "regexpp": "^3.0.0",
"semver": "^7.3.2", "semver": "^7.3.2",
"tsutils": "^3.17.1" "tsutils": "^3.17.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz",
"integrity": "sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.22.0",
"@typescript-eslint/visitor-keys": "4.22.0"
}
},
"@typescript-eslint/types": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.22.0.tgz",
"integrity": "sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA==",
"dev": true
},
"@typescript-eslint/visitor-keys": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz",
"integrity": "sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.22.0",
"eslint-visitor-keys": "^2.0.0"
}
}
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.22.0.tgz",
"integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==", "integrity": "sha512-xJXHHl6TuAxB5AWiVrGhvbGL8/hbiCQ8FiWwObO3r0fnvBdrbWEDy1hlvGQOAWc6qsCWuWMKdVWlLAEMpxnddg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.14.1", "@typescript-eslint/scope-manager": "4.22.0",
"@typescript-eslint/types": "4.14.1", "@typescript-eslint/types": "4.22.0",
"@typescript-eslint/typescript-estree": "4.14.1", "@typescript-eslint/typescript-estree": "4.22.0",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0" "eslint-utils": "^2.0.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz",
"integrity": "sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.22.0",
"@typescript-eslint/visitor-keys": "4.22.0"
}
},
"@typescript-eslint/types": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.22.0.tgz",
"integrity": "sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz",
"integrity": "sha512-TkIFeu5JEeSs5ze/4NID+PIcVjgoU3cUQUIZnH3Sb1cEn1lBo7StSV5bwPuJQuoxKXlzAObjYTilOEKRuhR5yg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.22.0",
"@typescript-eslint/visitor-keys": "4.22.0",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz",
"integrity": "sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.22.0",
"eslint-visitor-keys": "^2.0.0"
}
}
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.22.0.tgz",
"integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==", "integrity": "sha512-z/bGdBJJZJN76nvAY9DkJANYgK3nlRstRRi74WHm3jjgf2I8AglrSY+6l7ogxOmn55YJ6oKZCLLy+6PW70z15Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/scope-manager": "4.14.1", "@typescript-eslint/scope-manager": "4.22.0",
"@typescript-eslint/types": "4.14.1", "@typescript-eslint/types": "4.22.0",
"@typescript-eslint/typescript-estree": "4.14.1", "@typescript-eslint/typescript-estree": "4.22.0",
"debug": "^4.1.1" "debug": "^4.1.1"
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz",
"integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==", "integrity": "sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.1", "@typescript-eslint/types": "4.22.0",
"@typescript-eslint/visitor-keys": "4.14.1" "@typescript-eslint/visitor-keys": "4.22.0"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.22.0.tgz",
"integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==", "integrity": "sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA==",
"dev": true "dev": true
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz",
"integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==", "integrity": "sha512-TkIFeu5JEeSs5ze/4NID+PIcVjgoU3cUQUIZnH3Sb1cEn1lBo7StSV5bwPuJQuoxKXlzAObjYTilOEKRuhR5yg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.1", "@typescript-eslint/types": "4.22.0",
"@typescript-eslint/visitor-keys": "4.14.1", "@typescript-eslint/visitor-keys": "4.22.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2", "semver": "^7.3.2",
"tsutils": "^3.17.1" "tsutils": "^3.17.1"
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "4.14.1", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz",
"integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==", "integrity": "sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.1", "@typescript-eslint/types": "4.22.0",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
} }
}, },
@ -302,15 +372,15 @@
} }
}, },
"array-includes": { "array-includes": {
"version": "3.1.2", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.2.tgz", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz",
"integrity": "sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw==", "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.0", "call-bind": "^1.0.2",
"define-properties": "^1.1.3", "define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1", "es-abstract": "^1.18.0-next.2",
"get-intrinsic": "^1.0.1", "get-intrinsic": "^1.1.1",
"is-string": "^1.0.5" "is-string": "^1.0.5"
} }
}, },
@ -540,25 +610,27 @@
} }
}, },
"es-abstract": { "es-abstract": {
"version": "1.18.0-next.2", "version": "1.18.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz",
"integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.2", "call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1", "es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2", "get-intrinsic": "^1.1.1",
"has": "^1.0.3", "has": "^1.0.3",
"has-symbols": "^1.0.1", "has-symbols": "^1.0.2",
"is-callable": "^1.2.2", "is-callable": "^1.2.3",
"is-negative-zero": "^2.0.1", "is-negative-zero": "^2.0.1",
"is-regex": "^1.1.1", "is-regex": "^1.1.2",
"is-string": "^1.0.5",
"object-inspect": "^1.9.0", "object-inspect": "^1.9.0",
"object-keys": "^1.1.1", "object-keys": "^1.1.1",
"object.assign": "^4.1.2", "object.assign": "^4.1.2",
"string.prototype.trimend": "^1.0.3", "string.prototype.trimend": "^1.0.4",
"string.prototype.trimstart": "^1.0.3" "string.prototype.trimstart": "^1.0.4",
"unbox-primitive": "^1.0.0"
} }
}, },
"es-to-primitive": { "es-to-primitive": {
@ -951,9 +1023,9 @@
"dev": true "dev": true
}, },
"get-intrinsic": { "get-intrinsic": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.0.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-M11rgtQp5GZMZzDL7jLTNxbDfurpzuau5uqRWDPvlHjfvg3TdScAZo96GLvhMjImrmR8uAt0FS2RLoMrfWGKlg==", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
@ -1008,9 +1080,9 @@
} }
}, },
"graceful-fs": { "graceful-fs": {
"version": "4.2.4", "version": "4.2.6",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
"dev": true "dev": true
}, },
"has": { "has": {
@ -1022,6 +1094,12 @@
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
} }
}, },
"has-bigints": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz",
"integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==",
"dev": true
},
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
@ -1029,15 +1107,15 @@
"dev": true "dev": true
}, },
"has-symbols": { "has-symbols": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
"dev": true "dev": true
}, },
"hosted-git-info": { "hosted-git-info": {
"version": "2.8.8", "version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true "dev": true
}, },
"ignore": { "ignore": {
@ -1084,10 +1162,25 @@
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
"dev": true "dev": true
}, },
"is-bigint": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz",
"integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==",
"dev": true
},
"is-boolean-object": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz",
"integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==",
"dev": true,
"requires": {
"call-bind": "^1.0.0"
}
},
"is-callable": { "is-callable": {
"version": "1.2.2", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz",
"integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==",
"dev": true "dev": true
}, },
"is-core-module": { "is-core-module": {
@ -1138,12 +1231,19 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true "dev": true
}, },
"is-number-object": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz",
"integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==",
"dev": true
},
"is-regex": { "is-regex": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz",
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.2",
"has-symbols": "^1.0.1" "has-symbols": "^1.0.1"
} }
}, },
@ -1322,9 +1422,9 @@
} }
}, },
"object-inspect": { "object-inspect": {
"version": "1.9.0", "version": "1.10.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.2.tgz",
"integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", "integrity": "sha512-gz58rdPpadwztRrPjZE9DZLOABUpTGdcANUgOwBFO1C+HZZhePoP83M65WGDmbpwFYJSWqavbl4SgDn4k8RYTA==",
"dev": true "dev": true
}, },
"object-keys": { "object-keys": {
@ -1358,14 +1458,14 @@
} }
}, },
"object.values": { "object.values": {
"version": "1.1.2", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.3.tgz",
"integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==", "integrity": "sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.0", "call-bind": "^1.0.2",
"define-properties": "^1.1.3", "define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1", "es-abstract": "^1.18.0-next.2",
"has": "^1.0.3" "has": "^1.0.3"
} }
}, },
@ -1548,12 +1648,12 @@
"dev": true "dev": true
}, },
"resolve": { "resolve": {
"version": "1.19.0", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
"integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"dev": true, "dev": true,
"requires": { "requires": {
"is-core-module": "^2.1.0", "is-core-module": "^2.2.0",
"path-parse": "^1.0.6" "path-parse": "^1.0.6"
} }
}, },
@ -1701,22 +1801,22 @@
} }
}, },
"string.prototype.trimend": { "string.prototype.trimend": {
"version": "1.0.3", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
"integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.0", "call-bind": "^1.0.2",
"define-properties": "^1.1.3" "define-properties": "^1.1.3"
} }
}, },
"string.prototype.trimstart": { "string.prototype.trimstart": {
"version": "1.0.3", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz",
"integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==",
"dev": true, "dev": true,
"requires": { "requires": {
"call-bind": "^1.0.0", "call-bind": "^1.0.2",
"define-properties": "^1.1.3" "define-properties": "^1.1.3"
} }
}, },
@ -1845,6 +1945,18 @@
"integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==",
"dev": true "dev": true
}, },
"unbox-primitive": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
"integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has-bigints": "^1.0.1",
"has-symbols": "^1.0.2",
"which-boxed-primitive": "^1.0.2"
}
},
"uri-js": { "uri-js": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -1879,6 +1991,19 @@
"isexe": "^2.0.0" "isexe": "^2.0.0"
} }
}, },
"which-boxed-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",
"integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==",
"dev": true,
"requires": {
"is-bigint": "^1.0.1",
"is-boolean-object": "^1.1.0",
"is-number-object": "^1.0.4",
"is-string": "^1.0.5",
"is-symbol": "^1.0.3"
}
},
"word-wrap": { "word-wrap": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",

View file

@ -19,11 +19,11 @@
}, },
"devDependencies": { "devDependencies": {
"@redhat-actions/action-io-generator": "^1.5.0", "@redhat-actions/action-io-generator": "^1.5.0",
"@redhat-actions/eslint-config": "^1.2.11", "@redhat-actions/eslint-config": "^1.3.2",
"@redhat-actions/tsconfig": "^1.1.0", "@redhat-actions/tsconfig": "^1.1.1",
"@types/node": "^12.12.7", "@types/node": "^12.12.7",
"@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.14.1", "@typescript-eslint/parser": "^4.22.0",
"@vercel/ncc": "^0.25.1", "@vercel/ncc": "^0.25.1",
"eslint": "^7.18.0", "eslint": "^7.18.0",
"typescript": "^4.0.5" "typescript": "^4.0.5"

View file

@ -16,7 +16,7 @@ export enum Inputs {
*/ */
EXTRA_ARGS = "extra-args", EXTRA_ARGS = "extra-args",
/** /**
* Name of the image to push * Name of the image to push (e.g. username/imagename or imagename)
* Required: true * Required: true
* Default: None. * Default: None.
*/ */
@ -28,7 +28,7 @@ export enum Inputs {
*/ */
PASSWORD = "password", PASSWORD = "password",
/** /**
* Registry where to push the image (eg. quay.io/username) * Hostname and optional namespace to push the image to (eg. quay.io/username or quay.io)
* Required: true * Required: true
* Default: None. * Default: None.
*/ */

View file

@ -44,7 +44,7 @@ async function run(): Promise<void> {
tagsList = tags.split(" "); tagsList = tags.split(" ");
// info message if user doesn't provides any tag // info message if user doesn't provides any tag
if (!tagsList.length) { if (tagsList.length === 0) {
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);
} }
@ -104,7 +104,7 @@ async function run(): Promise<void> {
// failing if image with any of the tag is not found in Docker as well as Podman // failing if image with any of the tag is not found in Docker as well as Podman
if (podmanMissingTags.length > 0 && dockerMissingTags.length > 0) { if (podmanMissingTags.length > 0 && dockerMissingTags.length > 0) {
throw new Error( throw new Error(
`All tags for "${imageToPush}" were not found in either Podman image storage, or Docker image storage. ` `All tags for "${imageToPush}" were not found in either Podman image storage, or Docker image storage. `
+ `Tag${podmanMissingTags.length !== 1 ? "s" : ""} "${podmanMissingTags.join(", ")}" ` + `Tag${podmanMissingTags.length !== 1 ? "s" : ""} "${podmanMissingTags.join(", ")}" `
+ `not found in Podman image storage, and tag${dockerMissingTags.length !== 1 ? "s" : ""} ` + `not found in Podman image storage, and tag${dockerMissingTags.length !== 1 ? "s" : ""} `
+ `"${dockerMissingTags.join(", ")}" not found in Docker image storage.` + `"${dockerMissingTags.join(", ")}" not found in Docker image storage.`
@ -149,15 +149,13 @@ async function run(): Promise<void> {
); );
} }
let pushMsg = `Pushing "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} ` let pushMsg = `Pushing "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} `
+ `"${tagsList.join(", ")}" to "${registry}"`; + `"${tagsList.join(", ")}" to "${registry}"`;
if (username) { if (username) {
pushMsg += ` as "${username}"`; pushMsg += ` as "${username}"`;
} }
core.info(pushMsg); core.info(pushMsg);
const registryWithoutTrailingSlash = registry.replace(/\/$/, "");
let creds = ""; let creds = "";
if (username && !password) { if (username && !password) {
core.warning("Username is provided, but password is missing"); core.warning("Username is provided, but password is missing");
@ -178,18 +176,27 @@ async function run(): Promise<void> {
)}_digest.txt`; )}_digest.txt`;
} }
const registryWithoutTrailingSlash = registry.replace(/\/$/, "");
const registryPath = `${registryWithoutTrailingSlash}/${imageInput}`;
core.info(`Combining image name "${imageInput}" and registry "${registry}" `
+ `to form registry path "${registryPath}"`);
if (imageInput.indexOf("/") > -1 && registry.indexOf("/") > -1) {
core.warning(`"${registryPath}" does not seem to be a valid registry path. `
+ `The registry path should not contain more than 2 slashes. `
+ `Refer to the Inputs section of the readme for naming image and registry.`);
}
// push the image // push the image
for (const tag of tagsList) { for (const tag of tagsList) {
const imageWithTag = `${imageToPush}:${tag}`; const imageWithTag = `${imageToPush}:${tag}`;
const registryPath = `${registryWithoutTrailingSlash}/${imageInput}:${tag}`;
const args = [ const args = [
"push", "push",
"--quiet", "--quiet",
"--digestfile", "--digestfile",
digestFile, digestFile,
imageWithTag, imageWithTag,
registryPath, `${registryPath}:${tag}`,
]; ];
if (podmanExtraArgs.length > 0) { if (podmanExtraArgs.length > 0) {
@ -207,7 +214,7 @@ async function run(): Promise<void> {
} }
await execute(await getPodmanPath(), args); await execute(await getPodmanPath(), args);
core.info(`Successfully pushed "${imageWithTag}" to "${registryPath}"`); core.info(`Successfully pushed "${imageWithTag}" to "${registryPath}"`);
registryPathList.push(registryPath); registryPathList.push(registryPath);
@ -228,7 +235,7 @@ async function run(): Promise<void> {
} }
async function pullImageFromDocker(): Promise<ImageStorageCheckResult> { async function pullImageFromDocker(): Promise<ImageStorageCheckResult> {
core.info(`Checking if "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} ` core.info(`🔍 Checking if "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} `
+ `"${tagsList.join(", ")}" is present in Docker image storage`); + `"${tagsList.join(", ")}" is present in Docker image storage`);
let imageWithTag; let imageWithTag;
const foundTags: string[] = []; const foundTags: string[] = [];
@ -241,7 +248,7 @@ async function pullImageFromDocker(): Promise<ImageStorageCheckResult> {
[ "pull", `docker-daemon:${imageWithTag}` ], [ "pull", `docker-daemon:${imageWithTag}` ],
{ ignoreReturnCode: true, failOnStdErr: false, group: true } { ignoreReturnCode: true, failOnStdErr: false, group: true }
); );
if (!commandResult.exitCode) { if (commandResult.exitCode === 0) {
foundTags.push(tag); foundTags.push(tag);
} }
else { else {
@ -261,7 +268,7 @@ async function pullImageFromDocker(): Promise<ImageStorageCheckResult> {
async function checkImageInPodman(): Promise<ImageStorageCheckResult> { async function checkImageInPodman(): Promise<ImageStorageCheckResult> {
// check if images exist in Podman's storage // check if images exist in Podman's storage
core.info(`Checking if "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} ` core.info(`🔍 Checking if "${imageToPush}" with tag${tagsList.length !== 1 ? "s" : ""} `
+ `"${tagsList.join(", ")}" is present in Podman image storage`); + `"${tagsList.join(", ")}" is present in Podman image storage`);
let imageWithTag; let imageWithTag;
const foundTags: string[] = []; const foundTags: string[] = [];
@ -274,7 +281,7 @@ async function checkImageInPodman(): Promise<ImageStorageCheckResult> {
[ "image", "exists", imageWithTag ], [ "image", "exists", imageWithTag ],
{ ignoreReturnCode: true } { ignoreReturnCode: true }
); );
if (!commandResult.exitCode) { if (commandResult.exitCode === 0) {
foundTags.push(tag); foundTags.push(tag);
} }
else { else {
@ -388,9 +395,11 @@ async function execute(
} }
run() run()
.catch(core.setFailed) .then(async () => {
.finally(() => {
if (isImageFromDocker) { if (isImageFromDocker) {
removeDockerImage(); await removeDockerImage();
} }
})
.catch((err) => {
core.setFailed(err.message);
}); });