From 0d6f797918ed3f9bd59d3818845085c788f45eaa Mon Sep 17 00:00:00 2001 From: Julien Stroheker Date: Thu, 30 Jan 2020 01:49:15 -0500 Subject: [PATCH] CD (#10) * test * new cd file * step * format * typo * typo * test git tag * test release * yaml --- .github/workflows/build.yml | 21 +++++++++++---------- .github/workflows/cd.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 30 +++++++++++++++--------------- .gitignore | 1 + Makefile | 13 +++++++++++++ 5 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 177c129..41d64b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,20 +2,21 @@ name: Build on: push: branches: - - master + - master jobs: build: name: Building ${{ matrix.image }} runs-on: ubuntu-latest strategy: matrix: - image: ['worker','publisher','client'] + image: ["worker", "publisher", "client"] steps: - - uses: actions/checkout@v2 - - name: Build Docker image - env: # Or as an environment variable - FTH_REGISTRY_PASSWORD: ${{ secrets.FTH_REGISTRY_PASSWORD }} - FTH_REGISTRY_USERNAME: ${{ secrets.FTH_REGISTRY_USERNAME }} - run: | - make build-${{ matrix.image }}-image - make push-mutable-${{ matrix.image }}-image + - uses: actions/checkout@v2 + - name: Build Docker image + env: # Or as an environment variable + FTH_REGISTRY_PASSWORD: ${{ secrets.FTH_REGISTRY_PASSWORD }} + FTH_REGISTRY_USERNAME: ${{ secrets.FTH_REGISTRY_USERNAME }} + run: | + make build-${{ matrix.image }}-image + make push-${{ matrix.image }}-image + make push-mutable-${{ matrix.image }}-image diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..75a6502 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,30 @@ +on: + release: + types: [published] +jobs: + build: + name: Releasing + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Azure Login + uses: Azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + - name: Helm tool installer + uses: Azure/setup-helm@v1 + - name: Kubectl tool installer + uses: Azure/setup-kubectl@v1 + - name: Get Kubeconfig + env: # Or as an environment variable + AKS_CLUSTER_NAME: ${{ secrets.AKS_CLUSTER_NAME }} + AKS_CLUSTER_RG_NAME: ${{ secrets.AKS_CLUSTER_RG_NAME }} + run: | + az aks get-credentials -n $AKS_CLUSTER_NAME -g $AKS_CLUSTER_RG_NAME + kubectl get pods --all-namespaces + - name: Update Charts + run: | + make helm-upgrade-publisher + make helm-upgrade-worker + make helm-upgrade-client + kubectl get pods --all-namespaces diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1afed3c..5d13e01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,19 +8,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - image: ['worker','publisher','client'] + image: ["worker", "publisher", "client"] steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v1 - with: - go-version: 1.13 - if: matrix.image != 'client' - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: '10.x' - if: matrix.image == 'client' - - name: Build image - run: | - make build-${{ matrix.image }}-binaries + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + if: matrix.image != 'client' + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: "10.x" + if: matrix.image == 'client' + - name: Build image + run: | + make build-${{ matrix.image }}-binaries diff --git a/.gitignore b/.gitignore index 676abc7..bfe50b2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules bin ihaq-* .env +spn.json **.pub juihaq sshkey diff --git a/Makefile b/Makefile index 754dd5c..09f2d60 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,11 @@ push-mutable-publisher-image: registry-login docker tag $(FTH_REGISTRY)/ihaq-publisher:$(IHAQ_VERSION) $(FTH_REGISTRY)/ihaq-publisher:$(MUTABLE_VERSION) docker push $(FTH_REGISTRY)/ihaq-publisher:$(MUTABLE_VERSION) +.PHONY: helm-upgrade-publisher +helm-upgrade-publisher: + # Dirty hack to bypass redis auth for demo + helm upgrade ihaq-worker charts/api --set image.tag=$(IHAQ_VERSION) --set redis.usePassword=false + ############################################################################### # WORKER ############################################################################### @@ -169,6 +174,10 @@ push-mutable-worker-image: registry-login docker tag $(FTH_REGISTRY)/ihaq-worker:$(IHAQ_VERSION) $(FTH_REGISTRY)/ihaq-worker:$(MUTABLE_VERSION) docker push $(FTH_REGISTRY)/ihaq-worker:$(MUTABLE_VERSION) +.PHONY: helm-upgrade-worker +helm-upgrade-client: + helm upgrade ihaq-worker charts/worker --set image.tag=$(IHAQ_VERSION) + ############################################################################### # CLIENT ############################################################################### @@ -189,3 +198,7 @@ push-client-image: registry-login push-mutable-client-image: registry-login docker tag $(FTH_REGISTRY)/ihaq-client:$(IHAQ_VERSION) $(FTH_REGISTRY)/ihaq-client:$(MUTABLE_VERSION) docker push $(FTH_REGISTRY)/ihaq-client:$(MUTABLE_VERSION) + +.PHONY: helm-upgrade-client +helm-upgrade-client: + helm upgrade ihaq-client charts/client --set image.tag=$(IHAQ_VERSION)