Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an action to automatically release on a tag #11

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+**' ] # Ex. v0.2.0, v0.2.1-rc2

env:
GOPROXY: https://proxy.golang.org

jobs:
docker-hub:
runs-on: ubuntu-latest
env:
IMG: tetrate/kubegres:${{ github.ref_name }}
PLATFORMS: linux/amd64,linux/arm64
steps:
- uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make docker-build-push
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ endif
## Run acceptance tests then deploy into Docker Hub the controller as the Docker image provided in arg ${IMG}
## and update the local file "kubegres.yaml" with the image ${IMG}
.PHONY: deploy
deploy: deploy-check test docker-build-push kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: deploy-check kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default > kubegres.yaml
@echo "DEPLOYED $(IMG) INTO DOCKER HUB. UPDATED 'kubegres.yaml' WITH '$(IMG)'. YOU CAN COMMIT 'kubegres.yaml' AND CREATE A RELEASE IN GITHUB."
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ and on [https://www.kubegres.io](https://www.kubegres.io). More details in the [
* Google talked about Kubegres in their [Kubernetes Podcast #146](https://kubernetespodcast.com/episode/146-kubernetes-1.21/).


**CVE builds**
While waiting for PRs to be accepted in the upstream repository and a new version is released, follow the next instructions to publish our own builds:
- Create the new image built by:
- exporting the image name `export IMG=$HUB/kubegres:<new-version>`. Use custom HUB while testing. `new-version` should follow the pattern `<current-version>-tetrate-v<patch-number>`, for example `v1.16-tetrate-v0` is the first CVEs fixing patch for v1.16 kubegres.
- run `make docker-build-push`. This will build the binarys and the docker images for different platforms (defaults are linux/amd64,linux/arm64). Example run: `IMG=$HUB/kubegres:v.16-tetrate-v0 make docker-bulid-push`.
- Check CVEs are fixed. Currently you'll need to ask the CVE master.
- Once checks are passed and the PR approved and merged, publish the image by running:
- `docker login` as `tetratebot`
- `crane copy $HUB/kubegres:<new-version> tetrate/kubegres:<new-version> --platform all`
- `docker logout`
**Tetrate CVE builds**
While waiting for PRs to be accepted in the upstream repository and a new version to be released, follow the next instructions to publish our own builds:
- Define the new version name by following the pattern `<current-version>-tetrate-v<patch-number>`, for example `v1.16-tetrate-v0` is the first CVEs fixing patch for v1.16 kubegres.
- Run `IMG=$HUB/kubegres:<new-version> make deploy` with the new version tag to update `kubegres.yaml` file and open a PR with the changes.
- Once the PR is approved and merged create a tag with the new version and push it to the repository. Check that this triggers the release action that will:
- Scan for CVEs in the new version.
- Build the binaries for the new version.
- Build the docker images and push them to the tetrate docker hub repository.
- Run acceptance tests.