Add IO generator and CI checks (#21)

* Add IO generator and CI checks
* Update Buildah build action to use v2 tag

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
Divyanshu Agrawal 2021-02-09 00:00:15 +05:30 committed by GitHub
parent 870f44bc9b
commit 4757eb3399
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 160 additions and 35 deletions

View file

@ -0,0 +1,69 @@
// This file was auto-generated by action-io-generator. Do not edit by hand!
export enum Inputs {
/**
* After copying the image, write the digest of the resulting image to the file.
* By default, the filename will be determined from the image and tag.
* The contents of this file are the digest output.
* Required: false
* Default: None.
*/
DIGESTFILE = "digestfile",
/**
* Extra args to be passed to podman push.
* Separate arguments by newline. Do not use quotes - @actions/exec will do the quoting for you.
* Required: false
* Default: None.
*/
EXTRA_ARGS = "extra-args",
/**
* Name of the image to push
* Required: true
* Default: None.
*/
IMAGE = "image",
/**
* Password to use as credential to authenticate to the registry
* Required: true
* Default: None.
*/
PASSWORD = "password",
/**
* Registry where to push the image (eg. quay.io/username)
* Required: true
* Default: None.
*/
REGISTRY = "registry",
/**
* The tag or tags of the image to push. For multiple tags, seperate by a space. For example, "latest v1"
* Required: false
* Default: "latest"
*/
TAGS = "tags",
/**
* Verify TLS certificates when contacting the registry
* Required: false
* Default: "true"
*/
TLS_VERIFY = "tls-verify",
/**
* Username to use as credential to authenticate to the registry
* Required: true
* Default: None.
*/
USERNAME = "username",
}
export enum Outputs {
/**
* The pushed image digest, as written to the "digestfile"
* Required: false
* Default: None.
*/
DIGEST = "digest",
/**
* A JSON array of registry paths to which the tag(s) were pushed
* Required: false
* Default: None.
*/
REGISTRY_PATHS = "registry-paths",
}

View file

@ -4,6 +4,7 @@ import * as io from "@actions/io";
import * as fs from "fs";
import * as path from "path";
import { splitByNewline } from "./util";
import { Inputs, Outputs } from "./generated/inputs-outputs";
interface ExecResult {
exitCode: number;
@ -35,15 +36,15 @@ async function getPodmanPath(): Promise<string> {
const dockerBaseUrl = "docker.io/library";
async function run(): Promise<void> {
const imageInput = core.getInput("image", { required: true });
const tags = core.getInput("tags") || "latest";
const imageInput = core.getInput(Inputs.IMAGE, { required: true });
const tags = core.getInput(Inputs.TAGS) || "latest";
// split tags
tagsList = tags.split(" ");
const registry = core.getInput("registry", { required: true });
const username = core.getInput("username", { required: true });
const password = core.getInput("password", { required: true });
const tlsVerify = core.getInput("tls-verify");
const digestFileInput = core.getInput("digestfile");
const registry = core.getInput(Inputs.REGISTRY, { required: true });
const username = core.getInput(Inputs.USERNAME, { required: true });
const password = core.getInput(Inputs.PASSWORD, { required: true });
const tlsVerify = core.getInput(Inputs.TLS_VERIFY);
const digestFileInput = core.getInput(Inputs.DIGESTFILE);
const inputExtraArgsStr = core.getInput("extra-args");
let podmanExtraArgs: string[] = [];
@ -187,13 +188,13 @@ async function run(): Promise<void> {
try {
const digest = (await fs.promises.readFile(digestFile)).toString();
core.info(digest);
core.setOutput("digest", digest);
core.setOutput(Outputs.DIGEST, digest);
}
catch (err) {
core.warning(`Failed to read digest file "${digestFile}": ${err}`);
}
core.setOutput("registry-paths", JSON.stringify(registryPathList));
core.setOutput(Outputs.REGISTRY_PATHS, JSON.stringify(registryPathList));
}
async function pullImageFromDocker(): Promise<ImageStorageCheckResult> {