mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-18 00:21:22 +00:00
Merge 2d3449ca18
into 7a95fa7ee0
This commit is contained in:
commit
1605082ff0
8 changed files with 39 additions and 5 deletions
|
@ -2,4 +2,7 @@ module.exports = {
|
|||
extends: [
|
||||
"@redhat-actions/eslint-config",
|
||||
],
|
||||
};
|
||||
ignorePatterns: [
|
||||
"src/generated/*"
|
||||
]
|
||||
};
|
||||
|
|
8
.github/workflows/docker_metadata_action.yml
vendored
8
.github/workflows/docker_metadata_action.yml
vendored
|
@ -63,6 +63,7 @@ jobs:
|
|||
layers: false
|
||||
tags: ${{ steps.docker-metadata.outputs.tags }}
|
||||
labels: ${{ steps.docker-metadata.outputs.labels }}
|
||||
annotations: ${{ steps.docker-metadata.outputs.annotations }}
|
||||
containerfiles: |
|
||||
./Containerfile
|
||||
extra-args: |
|
||||
|
@ -83,6 +84,8 @@ jobs:
|
|||
set -x
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.description"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Annotations."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Annotations."org.opencontainers.image.description"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.description"'
|
||||
|
||||
|
@ -107,7 +110,7 @@ jobs:
|
|||
|
||||
- name: Docker Metadata
|
||||
id: docker-metadata
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.IMAGE_NAME }}
|
||||
|
@ -154,6 +157,7 @@ jobs:
|
|||
with:
|
||||
tags: ${{ steps.docker-metadata.outputs.tags }}
|
||||
labels: ${{ steps.docker-metadata.outputs.labels }}
|
||||
annotations: ${{ steps.docker-metadata.outputs.annotations }}
|
||||
base-image: 'registry.access.redhat.com/openjdk/openjdk-11-rhel7'
|
||||
# To avoid hardcoding a particular version of the binary.
|
||||
content: |
|
||||
|
@ -181,5 +185,7 @@ jobs:
|
|||
set -x
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.description"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Annotations."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.OCIv1.config.Annotations."org.opencontainers.image.description"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.title"'
|
||||
buildah inspect ${{ steps.build_image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.description"'
|
||||
|
|
|
@ -15,6 +15,9 @@ inputs:
|
|||
labels:
|
||||
description: 'The labels of the image to build. Seperate by newline. For example, "io.containers.capabilities=sys_admin,mknod".'
|
||||
required: false
|
||||
annotations:
|
||||
description: 'The annotations of the image to build. Seperate by newline. For example, "org.opencontainers.image.version=1.5.6". Only supported by OCI images.'
|
||||
required: false
|
||||
base-image:
|
||||
description: 'The base image to use to create a new container image'
|
||||
required: false
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -16,12 +16,13 @@ export interface BuildahConfigSettings {
|
|||
workingdir?: string;
|
||||
arch?: string;
|
||||
labels?: string[];
|
||||
annotations?: string[];
|
||||
}
|
||||
|
||||
interface Buildah {
|
||||
buildUsingDocker(
|
||||
image: string, context: string, containerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, labels: string[], layers: string,
|
||||
useOCI: boolean, labels: string[], annotations: string[], layers: string,
|
||||
extraArgs: string[], tlsVerify: boolean, arch?: string, platform?: string,
|
||||
): Promise<CommandResult>;
|
||||
from(baseImage: string, tlsVerify: boolean, extraArgs: string[]): Promise<CommandResult>;
|
||||
|
@ -72,6 +73,7 @@ export class BuildahCli implements Buildah {
|
|||
buildArgs: string[],
|
||||
useOCI: boolean,
|
||||
labels: string[],
|
||||
annotations: string[],
|
||||
layers: string,
|
||||
extraArgs: string[],
|
||||
tlsVerify: boolean,
|
||||
|
@ -95,6 +97,12 @@ export class BuildahCli implements Buildah {
|
|||
args.push("--label");
|
||||
args.push(label);
|
||||
});
|
||||
if (useOCI) {
|
||||
annotations.forEach((annotation) => {
|
||||
args.push("--annotation");
|
||||
args.push(annotation);
|
||||
});
|
||||
}
|
||||
buildArgs.forEach((buildArg) => {
|
||||
args.push("--build-arg");
|
||||
args.push(buildArg);
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
// This file was auto-generated by action-io-generator. Do not edit by hand!
|
||||
export enum Inputs {
|
||||
/**
|
||||
* The annotations of the image to build. Seperate by newline. For example, "org.opencontainers.image.version=1.5.6". Only supported by OCI images.
|
||||
* Required: false
|
||||
* Default: None.
|
||||
*/
|
||||
ANNOTATIONS = "annotations",
|
||||
/**
|
||||
* Label the image with this ARCH, instead of defaulting to the host architecture
|
||||
* Required: false
|
||||
|
|
|
@ -36,6 +36,8 @@ export async function run(): Promise<void> {
|
|||
const tagsList: string[] = tags.trim().split(/\s+/);
|
||||
const labels = core.getInput(Inputs.LABELS);
|
||||
const labelsList: string[] = labels ? splitByNewline(labels) : [];
|
||||
const annotations = core.getInput(Inputs.ANNOTATIONS);
|
||||
const annotationList: string[] = annotations ? splitByNewline(annotations) : [];
|
||||
|
||||
const normalizedTagsList: string[] = [];
|
||||
let isNormalized = false;
|
||||
|
@ -96,6 +98,7 @@ export async function run(): Promise<void> {
|
|||
archs,
|
||||
platforms,
|
||||
labelsList,
|
||||
annotationList,
|
||||
buildahExtraArgs
|
||||
));
|
||||
}
|
||||
|
@ -152,6 +155,7 @@ async function doBuildUsingContainerFiles(
|
|||
archs: string[],
|
||||
platforms: string[],
|
||||
labels: string[],
|
||||
annotations: string[],
|
||||
extraArgs: string[]
|
||||
): Promise<string[]> {
|
||||
if (containerFiles.length === 1) {
|
||||
|
@ -185,6 +189,7 @@ async function doBuildUsingContainerFiles(
|
|||
buildArgs,
|
||||
useOCI,
|
||||
labels,
|
||||
annotations,
|
||||
layers,
|
||||
extraArgs,
|
||||
tlsVerify,
|
||||
|
@ -205,6 +210,7 @@ async function doBuildUsingContainerFiles(
|
|||
buildArgs,
|
||||
useOCI,
|
||||
labels,
|
||||
annotations,
|
||||
layers,
|
||||
extraArgs,
|
||||
tlsVerify,
|
||||
|
@ -223,6 +229,7 @@ async function doBuildUsingContainerFiles(
|
|||
buildArgs,
|
||||
useOCI,
|
||||
labels,
|
||||
annotations,
|
||||
layers,
|
||||
extraArgs,
|
||||
tlsVerify,
|
||||
|
@ -239,6 +246,7 @@ async function doBuildUsingContainerFiles(
|
|||
buildArgs,
|
||||
useOCI,
|
||||
labels,
|
||||
annotations,
|
||||
layers,
|
||||
extraArgs,
|
||||
tlsVerify
|
||||
|
|
Loading…
Reference in a new issue