From 4e3ddbe49ca00ae68bcab711627be60723019a0f Mon Sep 17 00:00:00 2001 From: Oleg Kunitsyn <114359669+hiddenmarten@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:55:05 +0200 Subject: [PATCH] [161] Add plain manifests to release process (#173) --- .github/workflows/helm-publish.yaml | 12 +++---- .github/workflows/release-assets.yaml | 46 +++++++++++++++++++++++++ .gitignore | 1 + Makefile | 12 +++---- site/content/en/docs/v0.1/quickstart.md | 7 ++-- 5 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/release-assets.yaml diff --git a/.github/workflows/helm-publish.yaml b/.github/workflows/helm-publish.yaml index e9b12bac..ea9e9084 100644 --- a/.github/workflows/helm-publish.yaml +++ b/.github/workflows/helm-publish.yaml @@ -30,12 +30,12 @@ jobs: with: version: 'v3.14.3' - - name: Get latest tag + - name: Get tag from current run run: | TAG=${{ github.ref_name }} echo "Tag for packaging chart is $TAG" - echo "LATEST_TAG=${TAG}" >> $GITHUB_ENV - echo "LATEST_TAG_TRIMMED_V=${TAG#v}" >> $GITHUB_ENV + echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV + echo "RELEASE_TAG_TRIMMED_V=${TAG#v}" >> $GITHUB_ENV - name: Helm login registry working-directory: charts @@ -49,12 +49,12 @@ jobs: working-directory: charts run: | helm package ${{ env.CHART_NAME }} \ - --version ${LATEST_TAG_TRIMMED_V} \ - --app-version ${LATEST_TAG} \ + --version ${RELEASE_TAG_TRIMMED_V} \ + --app-version ${RELEASE_TAG} \ --dependency-update - name: Helm push chart working-directory: charts run: | - helm push ${{ env.CHART_NAME }}-${LATEST_TAG_TRIMMED_V}.tgz \ + helm push ${{ env.CHART_NAME }}-${RELEASE_TAG_TRIMMED_V}.tgz \ oci://${{ env.REGISTRY }}/${{ env.CHARTS_REPOSITORY }} diff --git a/.github/workflows/release-assets.yaml b/.github/workflows/release-assets.yaml new file mode 100644 index 00000000..274d6a21 --- /dev/null +++ b/.github/workflows/release-assets.yaml @@ -0,0 +1,46 @@ +name: Upload release assets +on: + release: + types: + - created + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + release-assets: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + - uses: actions/setup-go@v5.0.0 + with: + go-version: 1.22.2 + - name: Get tag from current run + run: | + TAG=${{ github.ref_name }} + echo "Tag for packaging chart is $TAG" + echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV + echo "RELEASE_TAG_TRIMMED_V=${TAG#v}" >> $GITHUB_ENV + - run: make build-dist-manifests IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${RELEASE_TAG} + - uses: svenstaro/upload-release-action@2.9.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/etcd-operator.yaml + asset_name: etcd-operator.yaml + tag: ${{ github.ref }} + overwrite: true + - uses: svenstaro/upload-release-action@2.9.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/etcd-operator.crds.yaml + asset_name: etcd-operator.crds.yaml + tag: ${{ github.ref }} + overwrite: true + - uses: svenstaro/upload-release-action@2.9.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/etcd-operator.non-crds.yaml + asset_name: etcd-operator.non-crds.yaml + tag: ${{ github.ref }} + overwrite: true diff --git a/.gitignore b/.gitignore index dc773cc0..b447f47a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.so *.dylib bin +dist testbin/* Dockerfile.cross diff --git a/Makefile b/Makefile index 48918941..a001ac40 100644 --- a/Makefile +++ b/Makefile @@ -132,15 +132,13 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform - $(CONTAINER_TOOL) buildx rm project-v3-builder rm Dockerfile.cross -.PHONY: build-installer -build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment. +.PHONY: build-dist-manifests +build-dist-manifests: manifests generate kustomize yq ## Generate a consolidated YAML with CRDs and deployment. mkdir -p dist - @if [ -d "config/crd" ]; then \ - $(KUSTOMIZE) build config/crd > dist/install.yaml; \ - fi - echo "---" >> dist/install.yaml # Add a document separator before appending cd config/manager && $(KUSTOMIZE) edit set image ghcr.io/aenix-io/etcd-operator=${IMG} - $(KUSTOMIZE) build config/default >> dist/install.yaml + $(KUSTOMIZE) build config/default > dist/etcd-operator.yaml + $(KUSTOMIZE) build config/default | $(YQ) eval 'select(.kind != "CustomResourceDefinition")' - > dist/etcd-operator.non-crds.yaml + $(KUSTOMIZE) build config/default | $(YQ) eval 'select(.kind == "CustomResourceDefinition")' - > dist/etcd-operator.crds.yaml ##@ Deployment diff --git a/site/content/en/docs/v0.1/quickstart.md b/site/content/en/docs/v0.1/quickstart.md index 31e7fd62..e25afd75 100644 --- a/site/content/en/docs/v0.1/quickstart.md +++ b/site/content/en/docs/v0.1/quickstart.md @@ -8,22 +8,21 @@ Follow these instructions to install, run, and test etcd with etcd-operator in a Pre-requisites: - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -- [kustomize](https://github.com/kubernetes-sigs/kustomize) - Kubernetes cluster and `kubectl` configured to use it - If you don't have a Kubernetes cluster, you can use [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) to create a local one - [cert-manager](https://cert-manager.io/docs/installation/) installed in the cluster 1. Install etcd-operator: ```bash - kustomize build 'https://github.com/aenix-io/etcd-operator//config/default?ref=main' | kubectl apply -f - + kubectl apply -f https://github.com/aenix-io/etcd-operator/releases/download/latest/etcd-operator.yaml ``` 2. Check the operator is running: ```bash kubectl get pods -n etcd-operator-system -l control-plane=controller-manager ``` -3. Create an etcd cluster: +3. Create a simple etcd cluster: ```bash - kubectl apply -f https://github.com/aenix-io/etcd-operator/raw/main/config/samples/etcd.aenix.io_v1alpha1_etcdcluster.yaml + kubectl apply -f https://github.com/aenix-io/etcd-operator/raw/main/examples/manifests/etcdcluster-simple.yaml ``` **Caution**: by default emptyDir storage is used. It means such cluster configuration is not intended for long-term storage.