Skip to content

Commit 8e619b0

Browse files
committed
add spectro-release
1 parent e099ecc commit 8e619b0

File tree

3 files changed

+132
-12
lines changed

3 files changed

+132
-12
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Spectro Release
2+
run-name: Release for Cluster API AWS ${{ github.event.inputs.release_version }}
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: 'Cluster API Version to Build'
8+
required: true
9+
default: '0.0.0'
10+
rel_type:
11+
type: choice
12+
description: Type of release
13+
options:
14+
- release
15+
- rc
16+
jobs:
17+
builder:
18+
# edge-runner machine group is a bunch of machines in US Datacenter
19+
runs-on: ubuntu-latest
20+
# Initialize all secrets required for the job
21+
# Ensure that the credentials are provided as encrypted secrets
22+
env:
23+
SPECTRO_VERSION: ${{ github.event.inputs.release_version }}
24+
LEGACY_REGISTRY: us-docker.pkg.dev/palette-images/palette/cluster-api-aws
25+
FIPS_REGISTRY: us-docker.pkg.dev/palette-images-fips/palette/cluster-api-aws
26+
steps:
27+
-
28+
uses: mukunku/[email protected]
29+
id: checkTag
30+
with:
31+
tag: v${{ github.event.inputs.release_version }}-spectro
32+
-
33+
if: ${{ steps.checkTag.outputs.exists == 'true' }}
34+
run: |
35+
echo "Tag already exists for v${{ github.event.inputs.release_version }}-spectro..."
36+
exit 1
37+
-
38+
if: ${{ github.event.inputs.rel_type == 'rc' }}
39+
run: |
40+
echo "LEGACY_REGISTRY=us-east1-docker.pkg.dev/spectro-images/dev/cluster-api-aws" >> $GITHUB_ENV
41+
echo "FIPS_REGISTRY=us-east1-docker.pkg.dev/spectro-images/dev-fips/cluster-api-aws" >> $GITHUB_ENV
42+
-
43+
uses: actions/checkout@v3
44+
-
45+
name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v1
47+
-
48+
name: Login to private registry
49+
uses: docker/login-action@v1
50+
with:
51+
registry: ${{ secrets.REGISTRY_URL }}
52+
username: ${{ secrets.REGISTRY_USERNAME }}
53+
password: ${{ secrets.REGISTRY_PASSWORD }}
54+
-
55+
name: Login to dev private registry
56+
uses: docker/login-action@v1
57+
with:
58+
registry: ${{ secrets.DEV_REGISTRY_URL }}
59+
username: ${{ secrets.REGISTRY_USERNAME }}
60+
password: ${{ secrets.REGISTRY_PASSWORD }}
61+
-
62+
name: Build Image
63+
env:
64+
REGISTRY: ${{ env.LEGACY_REGISTRY }}
65+
run: |
66+
make docker-build-all
67+
make docker-push-all
68+
-
69+
name: Build Image - FIPS Mode
70+
env:
71+
FIPS_ENABLE: yes
72+
REGISTRY: ${{ env.FIPS_REGISTRY }}
73+
run: |
74+
make docker-build-all
75+
make docker-push-all
76+
-
77+
name: Create Release
78+
if: ${{ github.event.inputs.rel_type == 'release' }}
79+
id: create_release
80+
uses: actions/create-release@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
tag_name: v${{ github.event.inputs.release_version }}-spectro
85+
release_name: Release v${{ github.event.inputs.release_version }}-spectro
86+
body: |
87+
Release version v${{ github.event.inputs.release_version }}-spectro
88+
draft: false
89+
prerelease: false

Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,23 @@
1515
# limitations under the License.
1616

1717
# Build the manager binary
18-
ARG builder_image
19-
FROM ${builder_image} as toolchain
20-
18+
ARG BUILDER_GOLANG_VERSION
19+
# First stage: build the executable.
20+
FROM us-docker.pkg.dev/palette-images/build-base-images/golang:${BUILDER_GOLANG_VERSION}-alpine as toolchain
2121
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
2222
ARG goproxy=https://proxy.golang.org
2323
ENV GOPROXY=$goproxy
2424

25+
# FIPS
26+
ARG CRYPTO_LIB
27+
ENV GOEXPERIMENT=${CRYPTO_LIB:+boringcrypto}
28+
2529
FROM toolchain as builder
2630
WORKDIR /workspace
2731

32+
RUN apk update
33+
RUN apk add git gcc g++ curl
34+
2835
# Copy the Go Modules manifests
2936
COPY go.mod go.mod
3037
COPY go.sum go.sum
@@ -41,10 +48,18 @@ COPY ./ ./
4148
ARG package=.
4249
ARG ARCH
4350
ARG LDFLAGS
44-
RUN --mount=type=cache,target=/root/.cache/go-build \
51+
RUN --mount=type=cache,target=/root/.cache/go-build \
4552
--mount=type=cache,target=/go/pkg/mod \
4653
--mount=type=cache,target=/root/.local/share/golang \
47-
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}
54+
if [ ${CRYPTO_LIB} ]; \
55+
then \
56+
GOARCH=${ARCH} go-build-fips.sh -a -o manager sigs.k8s.io/cluster-api-provider-aws/v2 ;\
57+
else \
58+
GOARCH=${ARCH} go-build-static.sh -a -o manager sigs.k8s.io/cluster-api-provider-aws/v2 ;\
59+
fi
60+
RUN if [ "${CRYPTO_LIB}" ]; then assert-static.sh manager; fi
61+
RUN if [ "${CRYPTO_LIB}" ]; then assert-fips.sh manager; fi
62+
#RUN scan-govulncheck.sh manager
4863
ENTRYPOINT [ "/start.sh", "/workspace/manager" ]
4964

5065
# Copy the controller-manager into a thin image

Makefile

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
BUILDER_GOLANG_VERSION ?= 1.23
1516
ROOT_DIR_RELATIVE := .
1617

1718
include $(ROOT_DIR_RELATIVE)/common.mk
@@ -28,6 +29,7 @@ ARTIFACTS ?= $(REPO_ROOT)/_artifacts
2829
TOOLS_DIR := hack/tools
2930
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
3031
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
32+
GO_INSTALL := ./scripts/go_install.sh
3133

3234

3335
API_DIRS := cmd/clusterawsadm/api api exp/api controlplane/eks/api bootstrap/eks/api iam/api controlplane/rosa/api
@@ -90,7 +92,7 @@ endif
9092

9193
# Release variables
9294

93-
STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api-aws
95+
STAGING_REGISTRY ?= us-east1-docker.pkg.dev/spectro-images/dev/$(USER)/cluster-api-aws
9496
STAGING_BUCKET ?= k8s-staging-cluster-api-aws
9597
BUCKET ?= $(STAGING_BUCKET)
9698
PROD_REGISTRY := registry.k8s.io/cluster-api-aws
@@ -109,9 +111,22 @@ endif
109111
# image name used to build the cmd/clusterawsadm
110112
TOOLCHAIN_IMAGE := toolchain
111113

112-
TAG ?= dev
113-
ARCH ?= $(shell go env GOARCH)
114-
ALL_ARCH ?= amd64 arm arm64 ppc64le s390x
114+
# Fips Flags
115+
FIPS_ENABLE ?= ""
116+
BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION}
117+
118+
RELEASE_LOC := release
119+
ifeq ($(FIPS_ENABLE),yes)
120+
RELEASE_LOC := release-fips
121+
endif
122+
123+
SPECTRO_VERSION ?= 4.6.0-dev
124+
TAG ?= v2.7.1-spectro-${SPECTRO_VERSION}
125+
ARCH ?= amd64
126+
# ALL_ARCH = amd64 arm arm64 ppc64le s390x
127+
ALL_ARCH = amd64 arm64
128+
129+
REGISTRY ?= us-east1-docker.pkg.dev/spectro-images/dev/$(USER)/${RELEASE_LOC}
115130

116131
# main controller
117132
CORE_IMAGE_NAME ?= cluster-api-aws-controller
@@ -148,8 +163,8 @@ E2E_SKIP_EKS_UPGRADE ?= "false"
148163
EKS_SOURCE_TEMPLATE ?= eks/cluster-template-eks-control-plane-only.yaml
149164

150165
# set up `setup-envtest` to install kubebuilder dependency
151-
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.30.2
152-
SETUP_ENVTEST_VER := v0.0.0-20240923090159-236e448db12c
166+
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.31.0
167+
SETUP_ENVTEST_VER := release-0.19
153168
SETUP_ENVTEST_BIN := setup-envtest
154169
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
155170
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
@@ -372,7 +387,8 @@ clusterawsadm: ## Build clusterawsadm binary
372387

373388
.PHONY: docker-build
374389
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
375-
docker build --build-arg ARCH=$(ARCH) --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
390+
docker buildx build --load --platform linux/${ARCH} ${BUILD_ARGS} --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
391+
@echo $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
376392

377393
.PHONY: docker-build-all ## Build all the architecture docker images
378394
docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))

0 commit comments

Comments
 (0)