Skip to content

Commit bf3472a

Browse files
authored
Apply our customizations on top of upstream release-2.7 (#612)
1 parent abc7c63 commit bf3472a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1373
-480
lines changed

.circleci/config.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
version: 2.1
2+
orbs:
3+
go: circleci/[email protected]
4+
5+
jobs:
6+
test:
7+
resource_class: large
8+
executor:
9+
name: go/default
10+
tag: "1.22.3"
11+
steps:
12+
- checkout
13+
- go/load-cache
14+
- go/mod-download
15+
- run:
16+
command: make setup-envtest
17+
- go/save-cache
18+
- run:
19+
command: make test
20+
21+
build:
22+
machine:
23+
image: "ubuntu-2204:2024.05.1"
24+
environment:
25+
ALL_ARCH: "amd64 arm64"
26+
REGISTRY_AZURE: gsoci.azurecr.io/giantswarm
27+
REGISTRY_QUAY: quay.io/giantswarm
28+
REGISTRY_CHINA: giantswarm-registry.cn-shanghai.cr.aliyuncs.com/giantswarm
29+
steps:
30+
- checkout
31+
32+
- run:
33+
name: Ensure 'make generate' matches commit
34+
command: |
35+
make generate
36+
git diff --exit-code || { echo "There are differences in generated files. Please run and commit 'make generate'. Else we can run into CRDs mismatching the code."; exit 1; }
37+
38+
- run:
39+
name: Build the CAPA docker images
40+
command: |
41+
for registry in $REGISTRY_AZURE $REGISTRY_QUAY $REGISTRY_CHINA; do
42+
make docker-build-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$registry
43+
44+
if [ -n "$CIRCLE_TAG" ]; then
45+
echo "Building tag $CIRCLE_TAG"
46+
make docker-build-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$registry
47+
fi
48+
done
49+
50+
- run:
51+
name: Push to Azure
52+
command: |
53+
docker login --username $ACR_GSOCI_USERNAME --password $ACR_GSOCI_PASSWORD "${REGISTRY_AZURE%/*}"
54+
55+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_AZURE
56+
57+
if [ -n "$CIRCLE_TAG" ]; then
58+
echo "Pushing tag $CIRCLE_TAG"
59+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_AZURE
60+
fi
61+
62+
- run:
63+
name: Push to quay
64+
command: |
65+
docker login --username $QUAY_USERNAME --password $QUAY_PASSWORD quay.io
66+
67+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_QUAY
68+
69+
if [ -n "$CIRCLE_TAG" ]; then
70+
echo "Pushing tag $CIRCLE_TAG"
71+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_QUAY
72+
fi
73+
74+
- run:
75+
name: Push to aliyun
76+
command: |
77+
for n in $(seq 1 5); do
78+
(
79+
set -eu
80+
docker login --username $ALIYUN_USERNAME --password $ALIYUN_PASSWORD giantswarm-registry.cn-shanghai.cr.aliyuncs.com
81+
82+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_CHINA
83+
84+
if [ -n "${CIRCLE_TAG:-}" ]; then
85+
echo "Pushing tag $CIRCLE_TAG"
86+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_CHINA
87+
fi
88+
) || { echo "Failed attempt ${n}"; sleep 30; continue; }
89+
90+
echo "Succeeded in attempt ${n}"
91+
exit 0
92+
done
93+
94+
exit 1
95+
96+
workflows:
97+
version: 2
98+
build_and_update:
99+
jobs:
100+
- build:
101+
context:
102+
- architect
103+
filters:
104+
tags:
105+
only: /^v.*/
106+
- test

.github/workflows/release.yaml

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,60 @@
1+
# As opposed to https://github.com/kubernetes-sigs/cluster-api (CAPI), the CAPA upstream project does not offer
2+
# a GitHub action to automatically create releases from tags (as of 2023-08-21). Therefore, this is a Giant Swarm
3+
# fork-specific addition. We require a GitHub release containing the YAML manifests which we use in
4+
# cluster-api-provider-aws-app. Since doing this manually is very error-prone (see
5+
# `docs/book/src/development/releasing.md`), we run the needed commands here.
6+
17
name: release
28

39
on:
410
push:
511
tags:
6-
- 'v*'
12+
- 'v*'
713

814
permissions:
9-
contents: write # required to write to github release.
15+
contents: write # allow creating a release
1016

1117
jobs:
12-
release:
18+
build:
1319
name: Create draft release
1420
runs-on: ubuntu-latest
21+
env:
22+
GH_ORG_NAME: giantswarm
1523
steps:
24+
- name: Set env
25+
run: |
26+
if echo "${GITHUB_REF}" | grep -qF "vX.Y"; then
27+
>&2 echo "ERROR: Oops, you copy-pasted verbatim from the README.md - please ensure to replace 'vX.Y.Z' with an actual tag"
28+
exit 1
29+
fi
30+
31+
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV # strip off `refs/tags/` prefix
32+
1633
- name: checkout code
1734
uses: actions/checkout@v4
1835
with:
1936
fetch-depth: 0
37+
2038
- name: Set up Go
2139
uses: actions/setup-go@v5
2240
with:
2341
go-version: '1.22'
24-
- name: Set version info
25-
run: |
26-
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
27-
echo "PREVIOUS_VERSION=$(git describe --abbrev=0 2> /dev/null)" >> $GITHUB_ENV
28-
echo "RELEASE_BRANCH=release-$(echo ${GITHUB_REF_NAME} | grep -Eo '[0-9]\.[0-9]+')" >> $GITHUB_ENV
29-
echo "RELEASE_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
30-
- name: Run release
31-
run: |
32-
echo "Version is: $VERSION"
33-
echo "Previous version is: $PREVIOUS_VERSION"
34-
echo "Release branch is: $RELEASE_BRANCH"
35-
echo "Release tag is: $RELEASE_TAG"
36-
make release
42+
cache-dependency-path: |
43+
./go.sum
44+
./hack/tools/go.sum
45+
46+
- name: Generate release artifacts
3747
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
GITHUB_TOKEN: "unused" # since we create the release without using CAPA's Makefile target
49+
run: |
50+
make REGISTRY="registry.k8s.io/cluster-api-aws" RELEASE_TAG="${RELEASE_TAG}" release-manifests
51+
52+
# Instead of `make VERSION="${RELEASE_TAG}" create-gh-release upload-gh-artifacts`, which requires GitHub CLI
53+
# authentication, use an action which does the same.
54+
- name: Release
55+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # tag=v1
56+
with:
57+
draft: true
58+
files: out/*
59+
body: "This fork does not provide release changelogs."
60+
# `name` not needed since this takes the tag by default (which we also use above as ${RELEASE_TAG})

0 commit comments

Comments
 (0)