Fix failure if image name has "/" in it's name and present in docker (#40)

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
Divyanshu Agrawal 2021-04-23 23:59:56 +05:30 committed by GitHub
parent c812c2069e
commit 5ec72be08b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View file

@ -23,6 +23,7 @@ let podmanPath: string | undefined;
let isImageFromDocker = false;
let imageToPush: string;
let tagsList: string[];
let dockerBaseUrl: string;
async function getPodmanPath(): Promise<string> {
if (podmanPath == null) {
@ -34,7 +35,8 @@ async function getPodmanPath(): Promise<string> {
}
// base URL that gets appended if image is pulled from the Docker imaege storage
const dockerBaseUrl = "docker.io/library";
const DOCKER_IO = `docker.io`;
const DOCKER_IO_NAMESPACED = DOCKER_IO + `/library`;
async function run(): Promise<void> {
const DEFAULT_TAG = "latest";
@ -43,6 +45,9 @@ async function run(): Promise<void> {
// split tags
tagsList = tags.split(" ");
// handle the case when image name is 'namespace/imagename' and image is present in docker storage
dockerBaseUrl = imageInput.indexOf("/") > -1 ? DOCKER_IO : DOCKER_IO_NAMESPACED;
// info message if user doesn't provides any tag
if (tagsList.length === 0) {
core.info(`Input "${Inputs.TAGS}" is not provided, using default tag "${DEFAULT_TAG}"`);