Skip to content

Commit 9b7f9a6

Browse files
committed
add README and CircleCI
1 parent b13114e commit 9b7f9a6

File tree

2 files changed

+181
-46
lines changed

2 files changed

+181
-46
lines changed

.circleci/config.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: 2.1
2+
3+
4+
jobs:
5+
build:
6+
machine:
7+
image: "ubuntu-2204:2022.10.2"
8+
environment:
9+
ALL_ARCH: "amd64 arm64"
10+
REGISTRY_AZURE: gsoci.azurecr.io/giantswarm
11+
REGISTRY_QUAY: quay.io/giantswarm
12+
REGISTRY_CHINA: giantswarm-registry.cn-shanghai.cr.aliyuncs.com/giantswarm
13+
14+
# We don't build all components, e.g. not CAPD or clusterctl
15+
ALL_DOCKER_BUILD: "core kubeadm-bootstrap kubeadm-control-plane"
16+
resource_class: xlarge # building several Docker images for multiple architectures is otherwise slow
17+
steps:
18+
- checkout
19+
20+
- run:
21+
name: Build the CAPI docker images
22+
command: |
23+
# Non-interactive logs (much shorter)
24+
export DOCKER_BUILDKIT=1
25+
export BUILDKIT_PROGRESS=plain
26+
27+
for registry in $REGISTRY_AZURE $REGISTRY_QUAY $REGISTRY_CHINA; do
28+
make docker-build-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG=$CIRCLE_SHA1 REGISTRY=$registry
29+
30+
if [ -n "$CIRCLE_TAG" ]; then
31+
echo "Building tag $CIRCLE_TAG"
32+
make docker-build-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG="$CIRCLE_TAG" REGISTRY=$registry
33+
fi
34+
done
35+
36+
docker images
37+
38+
- run:
39+
name: Push to Azure
40+
command: |
41+
docker login --username $ACR_GSOCI_USERNAME --password $ACR_GSOCI_PASSWORD "${REGISTRY_AZURE%%/*}"
42+
43+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_AZURE
44+
45+
if [ -n "$CIRCLE_TAG" ]; then
46+
echo "Pushing tag $CIRCLE_TAG"
47+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_AZURE
48+
fi
49+
50+
- run:
51+
name: Push to quay
52+
command: |
53+
docker login --username $QUAY_USERNAME --password $QUAY_PASSWORD quay.io
54+
55+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_QUAY
56+
57+
if [ -n "$CIRCLE_TAG" ]; then
58+
echo "Pushing tag $CIRCLE_TAG"
59+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_QUAY
60+
fi
61+
62+
- run:
63+
name: Push to aliyun
64+
command: |
65+
for n in $(seq 1 5); do
66+
(
67+
set -eu
68+
docker login --username $ALIYUN_USERNAME --password $ALIYUN_PASSWORD giantswarm-registry.cn-shanghai.cr.aliyuncs.com
69+
70+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG=$CIRCLE_SHA1 REGISTRY=$REGISTRY_CHINA
71+
72+
if [ -n "${CIRCLE_TAG:-}" ]; then
73+
echo "Pushing tag $CIRCLE_TAG"
74+
make docker-push-all ALL_ARCH="$ALL_ARCH" ALL_DOCKER_BUILD="$ALL_DOCKER_BUILD" TAG="$CIRCLE_TAG" REGISTRY=$REGISTRY_CHINA
75+
fi
76+
) || { echo "Failed attempt ${n}"; sleep 30; continue; }
77+
78+
echo "Succeeded in attempt ${n}"
79+
exit 0
80+
done
81+
82+
exit 1
83+
84+
workflows:
85+
version: 2
86+
build_and_update:
87+
jobs:
88+
- build:
89+
context:
90+
- architect
91+
filters:
92+
tags:
93+
only: /^v.*/

README.md

Lines changed: 88 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,107 @@
1-
<a href="https://cluster-api.sigs.k8s.io"><img alt="capi" src="./logos/kubernetes-cluster-logos_final-02.svg" width="160x" /></a>
2-
<p>
3-
<a href="https://godoc.org/sigs.k8s.io/cluster-api"><img src="https://godoc.org/sigs.k8s.io/cluster-api?status.svg"></a>
4-
<!-- join kubernetes slack channel for cluster-api -->
5-
<a href="http://slack.k8s.io/">
6-
<img src="https://img.shields.io/badge/join%20slack-%23cluster--api-brightgreen"></a>
7-
<!-- latest stable release badge -->
8-
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/kubernetes-sigs/cluster-api">
9-
</p>
10-
111
# Cluster API
122

13-
### 👋 Welcome to our project! Our [Book](https://cluster-api.sigs.k8s.io) can help you get started and provides lots of in-depth information.
3+
This is Giant Swarm's fork. See the upstream [cluster-api README](https://github.com/kubernetes-sigs/cluster-api/blob/main/README.md) for official documentation.
4+
5+
## How to work with this repo
6+
7+
Currently, we try to follow the upstream `release-X.Y` branch to always get the latest stable release and fixes, but not untested commits from `main`. Our only differences against upstream should be in this `README.md` and `.circleci/`. Other changes should be opened as PR for the upstream project first.
8+
9+
We release cluster-api versions with [cluster-api-app](https://github.com/giantswarm/cluster-api-app/). To provide the YAML manifests, we use GitHub releases as the upstream project. The scripts in `cluster-api-app` convert them into the final manifests.
10+
11+
### Repo setup
12+
13+
Since we follow upstream, add their Git repo as remote from which we merge commits:
14+
15+
```sh
16+
git clone git@github.com:giantswarm/cluster-api.git
17+
cd cluster-api
18+
git remote add upstream https://github.com/kubernetes-sigs/cluster-api.git
19+
```
20+
21+
### Test and release
22+
23+
If you have a non-urgent fix, create an upstream PR and wait until it gets released. We call this release `vX.Y.Z` in the below instructions, so please fill in the desired tag.
24+
25+
Please follow the development workflow:
26+
27+
- Ensure a stable release branch exists in our fork repo. For example with a desired upstream release v1.4.5, the branch is `release-1.4`. If it does not exist on our side yet, copy the branch from upstream and add our changes such as `README.md` and `.circleci/` on top.
28+
- Create a working branch for your changes
29+
- We want to use stable upstream release tags unless a hotfix is absolutely required ([decision](https://intranet.giantswarm.io/docs/product/pdr/010_fork_management/)). Please decide what type of change you're making:
30+
31+
- Either: you want to merge and test the latest upstream tag
32+
33+
```sh
34+
git fetch upstream
35+
36+
git checkout -b my-working-branch release-X.Y
37+
38+
# Create a merge commit using upstream's desired release tag (the one we want
39+
# to upgrade to).
40+
# This creates a commit message such as "Merge tag 'v1.4.5' into release-1.4".
41+
git merge --no-ff vX.Y.Z
42+
43+
# Since we want the combined content of our repo and the upstream Git tag,
44+
# we need to create our own tag on the merge commit
45+
git tag "vX.Y.Z-gs-$(git rev-parse --short HEAD)"
46+
47+
# Push your working branch. This triggers image build in CircleCI
48+
git push
1449

15-
#### Useful links
16-
- [Feature proposals](./docs/proposals)
17-
- [Quick Start](https://cluster-api.sigs.k8s.io/user/quick-start.html)
50+
# Push your Giant Swarm tag (assuming `origin` is the Giant Swarm fork).
51+
# This triggers the GitHub release action - please continue reading below!
52+
git push origin "vX.Y.Z-gs-$(git rev-parse --short HEAD)"
53+
```
1854

19-
## ✨ What is the Cluster API?
55+
- Or: you want to implement something else, such as working on some issue that we have which is not fixed in upstream yet. Note that for testing changes to upstream, you probably better base your work on the `upstream/main` branch and try your change together with the latest commits from upstream. This also avoids merge conflicts. Maintainers can then help you cherry-pick into their release branches. The latest release branch is usually a bit behind `main`.
2056

21-
Cluster API is a Kubernetes subproject focused on providing declarative APIs and tooling to simplify provisioning, upgrading, and operating multiple Kubernetes clusters.
57+
```sh
58+
git checkout -b my-working-branch release-X.Y # or based on `main` instead of `release-X.Y`, see hint above
2259
23-
Started by the Kubernetes Special Interest Group (SIG) Cluster Lifecycle, the Cluster API project uses Kubernetes-style APIs and patterns to automate cluster lifecycle management for platform operators. The supporting infrastructure, like virtual machines, networks, load balancers, and VPCs, as well as the Kubernetes cluster configuration are all defined in the same way that application developers operate deploying and managing their workloads. This enables consistent and repeatable cluster deployments across a wide variety of infrastructure environments.
60+
# Make some changes and commit as usual
61+
git commit
2462
25-
### ⚙️ Providers
63+
git tag "vX.Y.Z-gs-$(git rev-parse --short HEAD)"
2664
27-
Cluster API can be extended to support any infrastructure (AWS, Azure, vSphere, etc.), bootstrap or control plane (kubeadm is built-in) provider. There is a growing list of [supported providers](https://cluster-api.sigs.k8s.io/reference/providers.html) available.
65+
# Push your working branch. This triggers image build in CircleCI
66+
git push
2867
29-
<!-- ANCHOR: Community -->
68+
# Push your Giant Swarm tag (assuming `origin` is the Giant Swarm fork).
69+
# This triggers the GitHub release action - please continue reading below!
70+
git push origin "vX.Y.Z-gs-$(git rev-parse --short HEAD)"
71+
```
3072

31-
## 🤗 Community, discussion, contribution, and support
73+
- Check that the [CircleCI pipeline](https://app.circleci.com/pipelines/github/giantswarm/cluster-api) succeeds for the desired Git tag in order to produce images. If the tag build fails, fix it.
74+
- Check that the [GitHub release action](https://github.com/giantswarm/cluster-api/actions) for the `vX.Y.Z-gs-...` tag succeeds
75+
- Edit [that draft GitHub release](https://github.com/giantswarm/cluster-api/releases) and turn it from draft to released. This makes the release's manifest files available on the internet, as used in [cluster-api-app](https://github.com/giantswarm/cluster-api-app).
76+
- Test the changes in the app
3277
33-
Cluster API is developed in the open, and is constantly being improved by our users, contributors, and maintainers. It is because of you that we are able to automate cluster lifecycle management for the community. Join us!
78+
- Replace `.image.tag` in [cluster-api-app's `values.yaml`](https://github.com/giantswarm/cluster-api-app/blob/master/helm/cluster-api/values.yaml) with the new tag `vX.Y.Z-gs-...`.
79+
- Run `cd cluster-api-app && make generate` to update manifests
80+
- Commit and push your working branch for `cluster-api-app` to trigger CircleCI pipeline
81+
- Install and test the app thoroughly on a management cluster. Continue with the next step only once you're confident.
82+
- Open PR for `cluster-api` fork (your working branch)
3483
35-
If you have questions or want to get the latest project news, you can connect with us in the following ways:
84+
- If you merged an upstream release tag, we should target our `release-X.Y` branch with the PR.
85+
- On the other hand, if you implemented something else which is not in upstream yet, we should target `upstream/main` so that it first lands in the upstream project, officially approved, tested and released. Afterwards, you would repeat this whole procedure and merge the release that includes your fix. For a quick in-house hotfix, you can alternatively do a quicker PR targeted against our `release-X.Y` branch.
86+
- Also open PR for `cluster-api-app` change
87+
- Once merged, manually bump the version in the respective collection to deploy it for one provider (e.g. [capa-app-collection](https://github.com/giantswarm/capa-app-collection/))
3688
37-
- Chat with us on the Kubernetes [Slack](http://slack.k8s.io/) in the [#cluster-api][#cluster-api slack] channel
38-
- Subscribe to the [SIG Cluster Lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) Google Group for access to documents and calendars
39-
- Join our Cluster API working group sessions where we share the latest project news, demos, answer questions, and triage issues
40-
- Weekly on Wednesdays @ 10:00 PT on [Zoom][zoomMeeting]
41-
- Previous meetings: \[ [notes][notes] | [recordings][recordings] \]
89+
### Keep fork customizations up to date
4290
43-
Pull Requests and feedback on issues are very welcome!
44-
See the [issue tracker] if you're unsure where to start, especially the [Good first issue] and [Help wanted] tags, and
45-
also feel free to reach out to discuss.
91+
Only `README.md`, `.github/` and `.circleci/` should differ between upstream and our fork, so the diff of everything else should be empty, or at worst, contain hotfixes that are not in upstream yet:
4692
47-
See also our [contributor guide](CONTRIBUTING.md) and the Kubernetes [community page] for more details on how to get involved.
93+
```sh
94+
git fetch upstream
95+
git diff `# the upstream tag we merged recently` vX.Y.Z..origin/release-X.Y `# our release branch` -- ':!.circleci/' ':!README.md'
96+
```
4897
49-
### Code of conduct
98+
And we should also keep our `main` and `release-X.Y` branches in sync, so this diff should be empty:
5099
51-
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
100+
```sh
101+
git diff main..release-X.Y -- .circleci/ README.md .github/
102+
```
52103
53-
[community page]: https://kubernetes.io/community
54-
[notes]: https://docs.google.com/document/d/1ushaVqAKYnZ2VN_aa3GyKlS4kEd6bSug13xaXOakAQI
55-
[recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4
56-
[zoomMeeting]: https://zoom.us/j/861487554
57-
[implementerNotes]: https://docs.google.com/document/d/1IZ2-AZhe4r3CYiJuttyciS7bGZTTx4iMppcA8_Pr3xE/edit
58-
[providerZoomMeetingTues]: https://zoom.us/j/140808484
59-
[providerZoomMeetingWed]: https://zoom.us/j/424743530
60-
[issue tracker]: https://github.com/kubernetes-sigs/cluster-api/issues
61-
[#cluster-api slack]: https://kubernetes.slack.com/archives/C8TSNPY4T
62-
[Good first issue]: https://github.com/kubernetes-sigs/cluster-api/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22
63-
[Help wanted]: https://github.com/kubernetes-sigs/cluster-api/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+
104+
If this shows any output, please align the `main` branch with the release branches.
64105
65-
<!-- ANCHOR_END: Community -->
106+
We changed the upstream github actions to work with our repository (e.g., removing references to non-synced branches).
107+
When updating to a new release, please also update branch references in the actions (e.g., bump the release version in `.github/workflows/{test-release-weekly.yml, lint-docs-weekly.yml, weekly-security-scan.yaml`).

0 commit comments

Comments
 (0)