update inputs; readme
This commit is contained in:
parent
2b8c0ec844
commit
3697f3078d
19
action.yaml
19
action.yaml
@ -1,4 +1,4 @@
|
||||
name: Docker Tag
|
||||
name: Tag Manifest
|
||||
description: Tags an existing container manifest in a remote registry without pulling/pushing any images
|
||||
runs:
|
||||
using: node16
|
||||
@ -7,21 +7,18 @@ inputs:
|
||||
registry:
|
||||
description: URL to the container registry
|
||||
required: true
|
||||
insecure-registry:
|
||||
insecure:
|
||||
description: If "true", will use HTTP rather than HTTPS
|
||||
required: false
|
||||
image:
|
||||
description: The name of the image in the registry
|
||||
required: true
|
||||
old-tag:
|
||||
description: The tag of the existing image to be re-tagged
|
||||
required: true
|
||||
new-tags:
|
||||
description: Newline delimited list of new tags to apply to the image
|
||||
required: true
|
||||
username:
|
||||
description: Username to use to authenticate to the container registry
|
||||
required: false
|
||||
password:
|
||||
description: Password to use to authenticate to the container registry
|
||||
required: false
|
||||
manifest:
|
||||
description: The name/tag of the existing manifest in the registry
|
||||
required: true
|
||||
tags:
|
||||
description: Newline or comma delimited list of new tags to apply to the manifest
|
||||
required: true
|
||||
|
24
dist/index.js
vendored
24
dist/index.js
vendored
@ -2875,16 +2875,15 @@ async function main() {
|
||||
const input = {
|
||||
registry: core.getInput('registry'),
|
||||
registry_url: null,
|
||||
insecure_registry: core.getInput('insecure-registry') === 'true',
|
||||
image: core.getInput('image'),
|
||||
old_tag: core.getInput('old-tag'),
|
||||
new_tags: core.getInput('new-tags').trim().split('\n'),
|
||||
insecure: core.getInput('insecure') === 'true',
|
||||
username: core.getInput('username'),
|
||||
password: core.getInput('password'),
|
||||
manifest: parse_manifest_tag(core.getInput('manifest')),
|
||||
tags: parse_tags(core.getInput('tags').trim()),
|
||||
token: null,
|
||||
};
|
||||
|
||||
input.registry_url = `http${input.insecure_registry ? '' : 's'}://${input.registry}`;
|
||||
input.registry_url = `http${input.insecure ? '' : 's'}://${input.registry}`;
|
||||
console.log('Tagging %s/%s:%s with new tags', input.registry, input.image, input.old_tag, input.new_tags);
|
||||
|
||||
const manifest = await get_manifest(input);
|
||||
@ -2902,6 +2901,21 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
function parse_manifest_tag(full_tag) {
|
||||
const colon_index = full_tag.lastIndexOf(':');
|
||||
const image = full_tag.slice(0, colon_index);
|
||||
const tag = full_tag.slice(colon_index + 1);
|
||||
return { image, tag };
|
||||
}
|
||||
|
||||
function parse_tags(tags) {
|
||||
if (tags.indexOf('\n') < 0) {
|
||||
return tags.split(',').map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
return tags.split('\n').map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
async function get_manifest(input) {
|
||||
const path = `/v2/${input.image}/manifests/${input.old_tag}`;
|
||||
let { status, headers, body } = await http_req('GET', input.registry_url + path, {
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
24
index.js
24
index.js
@ -14,16 +14,15 @@ async function main() {
|
||||
const input = {
|
||||
registry: core.getInput('registry'),
|
||||
registry_url: null,
|
||||
insecure_registry: core.getInput('insecure-registry') === 'true',
|
||||
image: core.getInput('image'),
|
||||
old_tag: core.getInput('old-tag'),
|
||||
new_tags: core.getInput('new-tags').trim().split('\n'),
|
||||
insecure: core.getInput('insecure') === 'true',
|
||||
username: core.getInput('username'),
|
||||
password: core.getInput('password'),
|
||||
manifest: parse_manifest_tag(core.getInput('manifest')),
|
||||
tags: parse_tags(core.getInput('tags').trim()),
|
||||
token: null,
|
||||
};
|
||||
|
||||
input.registry_url = `http${input.insecure_registry ? '' : 's'}://${input.registry}`;
|
||||
input.registry_url = `http${input.insecure ? '' : 's'}://${input.registry}`;
|
||||
console.log('Tagging %s/%s:%s with new tags', input.registry, input.image, input.old_tag, input.new_tags);
|
||||
|
||||
const manifest = await get_manifest(input);
|
||||
@ -41,6 +40,21 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
function parse_manifest_tag(full_tag) {
|
||||
const colon_index = full_tag.lastIndexOf(':');
|
||||
const image = full_tag.slice(0, colon_index);
|
||||
const tag = full_tag.slice(colon_index + 1);
|
||||
return { image, tag };
|
||||
}
|
||||
|
||||
function parse_tags(tags) {
|
||||
if (tags.indexOf('\n') < 0) {
|
||||
return tags.split(',').map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
return tags.split('\n').map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
async function get_manifest(input) {
|
||||
const path = `/v2/${input.image}/manifests/${input.old_tag}`;
|
||||
let { status, headers, body } = await http_req('GET', input.registry_url + path, {
|
||||
|
53
readme.md
53
readme.md
@ -3,7 +3,42 @@ Action for re-tagging an existing docker multi-arch manifest
|
||||
|
||||
## Inputs
|
||||
|
||||
<!-- -->
|
||||
### `registry`
|
||||
|
||||
URL to the container registry
|
||||
|
||||
required: true
|
||||
|
||||
### `insecure`
|
||||
|
||||
If "true", will use HTTP rather than HTTPS
|
||||
|
||||
required: false
|
||||
|
||||
### `username`
|
||||
|
||||
Username to use to authenticate to the container registry
|
||||
|
||||
required: false
|
||||
|
||||
### `password`
|
||||
|
||||
Password to use to authenticate to the container registry
|
||||
|
||||
required: false
|
||||
|
||||
### `manifest`
|
||||
|
||||
The name/tag of the existing manifest in the registry
|
||||
|
||||
required: true
|
||||
|
||||
### `tags`
|
||||
|
||||
Newline or comma delimited list of new tags to apply to the manifest
|
||||
|
||||
required: true
|
||||
|
||||
|
||||
## Example usage
|
||||
|
||||
@ -13,15 +48,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Tag the "gitea.example.com/owner/package:latest" image with some new tags
|
||||
uses: https://gitea.jbrumond.me/actions/docker-tag@v0.1
|
||||
uses: https://gitea.jbrumond.me/actions/tag-manifest@v0.1
|
||||
with:
|
||||
# Container registry where the manifest is hosted
|
||||
registry: gitea.example.com
|
||||
|
||||
# Credentials to access the registry
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
insecure-registry: false
|
||||
image: owner/package
|
||||
old-tag: latest
|
||||
new-tags: |
|
||||
|
||||
# Existing manifest to apply tags to
|
||||
manifest: owner/package:latest
|
||||
|
||||
# New tags to apply (either of these works):
|
||||
tags: tag1,tag2,tag3
|
||||
tags: |
|
||||
tag1
|
||||
tag2
|
||||
tag3
|
||||
|
Loading…
x
Reference in New Issue
Block a user