Skip to content

Commit

Permalink
ci: update deployment steps
Browse files Browse the repository at this point in the history
Signed-off-by: zhanghongtong <[email protected]>
  • Loading branch information
Rory-Z committed Jan 13, 2022
1 parent 2bb3abe commit 208368b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 19 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/cts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ jobs:
with:
go-version: '1.17.3'
- name: Build image
run: eval $(minikube docker-env) && docker build -t emqx/emqx-operator-controller:$(git describe --tags) .
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
run: eval $(minikube docker-env) && docker build -t $IMG .
- name: Deploy controller
run: |
make deploy
if ! git diff --quiet; then
echo "Need run make deploy"
exit 1
fi
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
run: make deploy
- name: Check operator
timeout-minutes: 15
run: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/build.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Build emqx operator
name: Release emqx operator

on:
push:
tags:
- "*"

jobs:
docker:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check image tag for yaml
run: |
tag=$(cat config/samples/operator/controller.yaml | egrep "image:[[:space:]]emqx/emqx-operator-controller" | sed -r 's|image:[[:space:]]emqx/emqx-operator-controller:(.*)|\1|g' | tr -d '[:space:]')
if [ "$tag" != "${GITHUB_REF##*/}" ]; then
echo "Need update image tag for config/samples/operator/controller.yaml"
exit 1
fi
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/metadata-action@v3
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ jobs:
with:
go-version: '1.17.3'
- name: Build image
run: eval $(minikube docker-env) && docker build -t emqx/emqx-operator-controller:$(git describe --tags) .
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
run: eval $(minikube docker-env) && docker build -t $IMG .
- name: Deploy controller
run: |
make deploy
if ! git diff --quiet; then
echo "Need run make deploy"
exit 1
fi
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
run: make deploy
- name: Check operator
timeout-minutes: 10
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Image URL to use all building/pushing image targets
IMG ?= emqx/emqx-operator-controller:$(shell git describe --tags)
IMG ?= emqx/emqx-operator-controller:$(shell ./get-version)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
#CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
CRD_OPTIONS ?= "crd"
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: emqx/emqx-operator-controller
newTag: 1.0.0-40-g63013f1
newTag: 7549fa9
2 changes: 1 addition & 1 deletion config/samples/operator/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7902,7 +7902,7 @@ spec:
- --leader-elect
command:
- /manager
image: emqx/emqx-operator-controller:1.0.0-40-g63013f1
image: emqx/emqx-operator-controller:7549fa9
livenessProbe:
httpGet:
path: /healthz
Expand Down
11 changes: 11 additions & 0 deletions get-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

# ensure dir
cd -P -- "$(dirname -- "$0")"

if [ "$(git describe --tag | egrep "^[0-9]+\.[0-9]+\.[0-9]$")" != "" ]; then
git describe --tag
else
git rev-parse --short HEAD
fi

0 comments on commit 208368b

Please sign in to comment.