Add GOARM in Restic builder. Add PR container build action.
Signed-off-by: Xun Jiang <blackpiglet@gmail.com>pull/5771/head
parent
598333dca1
commit
601f4a9985
|
@ -0,0 +1,37 @@
|
||||||
|
name: build Velero containers on Dockerfile change
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'release-**'
|
||||||
|
paths:
|
||||||
|
- 'Dockerfile'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
# Although this action also calls docker-push.sh, it is not triggered
|
||||||
|
# by push, so BRANCH and TAG are empty by default. docker-push.sh will
|
||||||
|
# only build Velero image without pushing.
|
||||||
|
- name: Make Velero container without pushing to registry.
|
||||||
|
if: github.repository == 'vmware-tanzu/velero'
|
||||||
|
run: |
|
||||||
|
./hack/docker-push.sh
|
|
@ -62,7 +62,8 @@ env CGO_ENABLED=0 \
|
||||||
COPY . /go/src/github.com/vmware-tanzu/velero
|
COPY . /go/src/github.com/vmware-tanzu/velero
|
||||||
|
|
||||||
RUN mkdir -p /output/usr/bin && \
|
RUN mkdir -p /output/usr/bin && \
|
||||||
bash /go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh
|
export GOARM=$(echo "${GOARM}" | cut -c2-) && \
|
||||||
|
/go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh
|
||||||
|
|
||||||
# Velero image packing section
|
# Velero image packing section
|
||||||
FROM gcr.io/distroless/base-debian11@sha256:99133cb0878bb1f84d1753957c6fd4b84f006f2798535de22ebf7ba170bbf434
|
FROM gcr.io/distroless/base-debian11@sha256:99133cb0878bb1f84d1753957c6fd4b84f006f2798535de22ebf7ba170bbf434
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Add PR container build action, which will not push image. Add GOARM parameter.
|
|
@ -56,6 +56,18 @@ elif [[ "$triggeredBy" == "tags" ]]; then
|
||||||
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
|
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if both BRANCH and TAG are empty, then it's triggered by PR. Use target branch instead.
|
||||||
|
# BRANCH is needed in docker buildx command to set as image tag.
|
||||||
|
# When action is triggered by PR, just build container without pushing, so set type to local.
|
||||||
|
# When action is triggered by PUSH, need to push container, so set type to registry.
|
||||||
|
if [[ -z $BRANCH && -z $TAG ]]; then
|
||||||
|
echo "Test Velero container build without pushing, when Dockerfile is changed by PR."
|
||||||
|
BRANCH="${GITHUB_BASE_REF}-container"
|
||||||
|
OUTPUT_TYPE="local,dest=."
|
||||||
|
else
|
||||||
|
OUTPUT_TYPE="registry"
|
||||||
|
fi
|
||||||
|
|
||||||
TAG_LATEST=false
|
TAG_LATEST=false
|
||||||
if [[ ! -z "$TAG" ]]; then
|
if [[ ! -z "$TAG" ]]; then
|
||||||
echo "We're building tag $TAG"
|
echo "We're building tag $TAG"
|
||||||
|
@ -90,11 +102,9 @@ echo "BUILDX_PLATFORMS: $BUILDX_PLATFORMS"
|
||||||
|
|
||||||
echo "Building and pushing container images."
|
echo "Building and pushing container images."
|
||||||
|
|
||||||
# The use of "registry" as the buildx output type below instructs
|
|
||||||
# Docker to push the image
|
|
||||||
|
|
||||||
VERSION="$VERSION" \
|
VERSION="$VERSION" \
|
||||||
TAG_LATEST="$TAG_LATEST" \
|
TAG_LATEST="$TAG_LATEST" \
|
||||||
BUILDX_PLATFORMS="$BUILDX_PLATFORMS" \
|
BUILDX_PLATFORMS="$BUILDX_PLATFORMS" \
|
||||||
BUILDX_OUTPUT_TYPE="registry" \
|
BUILDX_OUTPUT_TYPE=$OUTPUT_TYPE \
|
||||||
make all-containers
|
make all-containers
|
||||||
|
|
Loading…
Reference in New Issue