-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,12 @@ on: | |
description: 'Cluster API Version to Build' | ||
required: true | ||
default: '0.0.0' | ||
rel_type: | ||
type: choice | ||
description: Type of release | ||
options: | ||
- release | ||
- rc | ||
jobs: | ||
builder: | ||
# edge-runner machine group is a bunch of machines in US Datacenter | ||
|
@@ -15,6 +21,8 @@ jobs: | |
# Ensure that the credentials are provided as encrypted secrets | ||
env: | ||
SPECTRO_VERSION: ${{ github.event.inputs.release_version }} | ||
LEGACY_REGISTRY: gcr.io/spectro-images-public/release/cluster-api-maas | ||
FIPS_REGISTRY: gcr.io/spectro-images-public/release-fips/cluster-api-maas | ||
steps: | ||
- | ||
uses: mukunku/[email protected] | ||
|
@@ -26,6 +34,11 @@ jobs: | |
run: | | ||
echo "Tag already exists for v${{ github.event.inputs.release_version }}-spectro..." | ||
exit 1 | ||
- | ||
if: ${{ github.event.inputs.rel_type == 'rc' }} | ||
run: | | ||
echo "LEGACY_REGISTRY=gcr.io/spectro-dev-public/release/cluster-api-maas" >> $GITHUB_ENV | ||
echo "FIPS_REGISTRY=gcr.io/spectro-dev-public/release-fips/cluster-api-maas" >> $GITHUB_ENV | ||
- | ||
uses: actions/checkout@v3 | ||
- | ||
|
@@ -41,28 +54,24 @@ jobs: | |
- | ||
name: Build Image | ||
env: | ||
REGISTRY: gcr.io/spectro-images-public/release/cluster-api-maas | ||
REGISTRY: ${{ env.LEGACY_REGISTRY }} | ||
run: | | ||
make docker-build | ||
make docker-push | ||
make docker-build-all | ||
make docker-push-all | ||
- | ||
name: Build Image - FIPS Mode | ||
env: | ||
FIPS_ENABLE: yes | ||
REGISTRY: gcr.io/spectro-images-public/release-fips/cluster-api-maas | ||
REGISTRY: ${{ env.FIPS_REGISTRY }} | ||
run: | | ||
make docker-build-all | ||
make docker-push-all | ||
- | ||
name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
name: Create Tag | ||
if: ${{ github.event.inputs.rel_type == 'release' }} | ||
id: tag_create | ||
uses: rickstaa/action-create-tag@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ github.event.inputs.release_version }}-spectro | ||
release_name: Release v${{ github.event.inputs.release_version }}-spectro | ||
body: | | ||
Release version ${{ github.event.inputs.release_version }} | ||
draft: false | ||
prerelease: false | ||
tag: v${{ github.event.inputs.release_version }}-spectro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,53 @@ | ||
# Build the manager binary | ||
FROM golang:1.19.8 as builder | ||
ARG BUILDER_GOLANG_VERSION | ||
# First stage: build the executable. | ||
FROM --platform=$TARGETPLATFORM gcr.io/spectro-images-public/golang:${BUILDER_GOLANG_VERSION}-alpine as toolchain | ||
|
||
FROM toolchain as builder | ||
WORKDIR /workspace | ||
|
||
RUN apk update | ||
RUN apk add git gcc g++ curl | ||
|
||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
RUN --mount=type=cache,target=/root/.local/share/golang \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
go mod download | ||
|
||
ARG CRYPTO_LIB | ||
ENV GOEXPERIMENT=${CRYPTO_LIB:+boringcrypto} | ||
# Copy the go source | ||
COPY main.go main.go | ||
COPY api/ api/ | ||
COPY pkg/ pkg/ | ||
COPY controllers/ controllers/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go | ||
|
||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.local/share/golang \ | ||
if [ ${CRYPTO_LIB} ];\ | ||
then \ | ||
GOARCH=${ARCH} go-build-fips.sh -a -o manager . ;\ | ||
else \ | ||
GOARCH=${ARCH} go-build-static.sh -a -o manager . ;\ | ||
fi | ||
|
||
RUN if [ "${CRYPTO_LIB}" ]; then assert-static.sh manager; fi | ||
RUN if [ "${CRYPTO_LIB}" ]; then assert-fips.sh manager; fi | ||
RUN scan-govulncheck.sh manager | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
USER nonroot:nonroot | ||
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies | ||
USER 65532 | ||
|
||
ENTRYPOINT ["/manager"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters