1
0
mirror of https://github.com/coreos/ignition.git synced 2026-02-06 00:47:49 +01:00
Files
ignition/build_for_container
Benjamin Gilbert 6e5de2dcc2 workflows: build and push ignition-validate container from GH Actions
Quay builds are amd64-only and haven't been especially reliable.  Use
GitHub Actions to build both amd64 and arm64 containers for the main
branch and for tags, and push them to Quay.  Continue building but not
pushing containers on PR.  Requires the QUAY_AUTH repo secret to be set
to a Docker credential.

Ideally we would cross-build the arm64 container by having the Dockerfile
specify FROM --platform=$BUILDPLATFORM for the builder container and set
GOARCH=$TARGETARCH.  However, Buildah < 1.24.1 doesn't support --platform
in FROM.  Build in emulation for now, and skip arm64 in PRs to speed up CI.

Fixes https://github.com/coreos/ignition/issues/1321.
2022-03-21 13:29:00 -04:00

32 lines
653 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
NAME="ignition"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${NAME}/v2"
GLDFLAGS=${GLDFLAGS:-}
if [ -z ${VERSION+a} ]; then
echo "Using version from git..."
VERSION=$(git describe --dirty --always)
fi
GLDFLAGS+="-X github.com/coreos/ignition/v2/internal/version.Raw=${VERSION}"
if [[ -n "$(git status -s)" ]]; then
echo "git repo not clean"
exit 1
fi
if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=${PWD}/bin/container/
fi
export GO11MODULE=on
export CGO_ENABLED=0
export GOFLAGS='-mod=vendor'
export GOOS=linux
go build -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/ignition-validate ${REPO_PATH}/validate