Skip to content

Commit ae9baa2

Browse files
fiunchinhoAndiDogcalvixmnitchev
authored
Apply our customizations on top of upstream release-2.5 (#607)
* Add Giant Swarm fork modifications * aws-cni-deleted-helm-managed-resources * Filter CNI subnets when creating EKS NodeGroup * Add non root volumes to AWSMachineTemplate * Support adding custom secondary VPC CIDR blocks in `AWSCluster` (backport) (#590) * S3 user data support for `AWSMachinePool` (#592) * Add GS workflow action --------- Co-authored-by: Andreas Sommer <[email protected]> Co-authored-by: calvix <[email protected]> Co-authored-by: Mario Nitchev <[email protected]>
1 parent 5383d35 commit ae9baa2

File tree

68 files changed

+1899
-575
lines changed

Some content is hidden

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

68 files changed

+1899
-575
lines changed

.circleci/config.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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: Build the CAPA docker images
34+
command: |
35+
for registry in $REGISTRY_AZURE $REGISTRY_QUAY $REGISTRY_CHINA; do
36+
make docker-build-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$registry
37+
38+
if [ -n "$CIRCLE_TAG" ]; then
39+
echo "Building tag $CIRCLE_TAG"
40+
make docker-build-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$registry
41+
fi
42+
done
43+
44+
- run:
45+
name: Push to Azure
46+
command: |
47+
docker login --username $ACR_GSOCI_USERNAME --password $ACR_GSOCI_PASSWORD "${REGISTRY_AZURE%/*}"
48+
49+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_AZURE
50+
51+
if [ -n "$CIRCLE_TAG" ]; then
52+
echo "Pushing tag $CIRCLE_TAG"
53+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_AZURE
54+
fi
55+
56+
- run:
57+
name: Push to quay
58+
command: |
59+
docker login --username $QUAY_USERNAME --password $QUAY_PASSWORD quay.io
60+
61+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_QUAY
62+
63+
if [ -n "$CIRCLE_TAG" ]; then
64+
echo "Pushing tag $CIRCLE_TAG"
65+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_QUAY
66+
fi
67+
68+
- run:
69+
name: Push to aliyun
70+
command: |
71+
for n in $(seq 1 5); do
72+
(
73+
set -eu
74+
docker login --username $ALIYUN_USERNAME --password $ALIYUN_PASSWORD giantswarm-registry.cn-shanghai.cr.aliyuncs.com
75+
76+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_CHINA
77+
78+
if [ -n "${CIRCLE_TAG:-}" ]; then
79+
echo "Pushing tag $CIRCLE_TAG"
80+
make docker-push-all ALL_ARCH="$ALL_ARCH" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_CHINA
81+
fi
82+
) || { echo "Failed attempt ${n}"; sleep 30; continue; }
83+
84+
echo "Succeeded in attempt ${n}"
85+
exit 0
86+
done
87+
88+
exit 1
89+
90+
workflows:
91+
version: 2
92+
build_and_update:
93+
jobs:
94+
- build:
95+
context:
96+
- architect
97+
filters:
98+
tags:
99+
only: /^v.*/
100+
- test

.github/workflows/release.yaml

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,76 @@
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:
16-
- name: checkout code
17-
uses: actions/checkout@v4
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+
33+
- name: Check out code
34+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag=v3.5.0
1835
with:
1936
fetch-depth: 0
20-
- name: Set up Go
21-
uses: actions/setup-go@v5
22-
with:
23-
go-version: '1.21'
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
37+
38+
# - name: Calculate Go version
39+
# run: echo "go_version=$(make go-version)" >> $GITHUB_ENV
40+
41+
# - name: Set up Go
42+
# uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # tag=v3.5.0
43+
# with:
44+
# go-version: ${{ env.go_version }}
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+
# Dealing with changelogs isn't that easy since Giant Swarm releases can jump from `v2.2.0` to `v2.3.1`
51+
# as we skip intermediate releases. Therefore, finding the required value for `PREVIOUS_VERSION` would be
52+
# a manual task. Better not deal with the changelog right now since it's unlikely that someone will look
53+
# at those in our fork (as compared to upstream's releases).
54+
printf '#!/bin/sh\necho "Changelogs are not filled in this fork"\n' > hack/releasechangelog.sh # old path of this tool
55+
mkdir -p hack/tools/bin
56+
printf '#!/bin/sh\necho "Changelogs are not filled in this fork" > out/CHANGELOG.md\n' > hack/tools/bin/release-notes
57+
chmod +x hack/tools/bin/release-notes
58+
59+
# We don't need the binaries and other stuff in the release, either. Really only the YAML manifests.
60+
sed -i -E -e '/\$\(MAKE\) (release-binaries|release-templates|release-policies)/d' Makefile
61+
sed -i -E -e '/cp metadata.yaml/d' Makefile
62+
63+
# To allow the above changes since normally the Makefile wouldn't allow a dirty Git repo
64+
sed -i -e '/Your local git repository contains uncommitted changes/d' Makefile
65+
66+
(set -x; make PREVIOUS_VERSION="${RELEASE_TAG}" RELEASE_TAG="${RELEASE_TAG}" release)
67+
68+
# Instead of `make VERSION="${RELEASE_TAG}" create-gh-release upload-gh-artifacts`, which requires GitHub CLI
69+
# authentication, use an action which does the same.
70+
- name: Release
71+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # tag=v1
72+
with:
73+
draft: true
74+
files: out/*
75+
body: "This fork does not provide release changelogs."
76+
# `name` not needed since this takes the tag by default (which we also use above as ${RELEASE_TAG})

0 commit comments

Comments
 (0)