From cd2b23947a4590d7b6a631145ae5125d6f2f0c43 Mon Sep 17 00:00:00 2001 From: Zach Wolfenbarger Date: Mon, 29 Jan 2024 15:48:07 -0600 Subject: [PATCH 1/3] Remove Jenkinsfile --- Jenkinsfile | 73 ----------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b1c608d..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,73 +0,0 @@ -#!groovy - -pipeline { - agent none - - options { - disableConcurrentBuilds() - } - - stages { - stage('Notify Slack') { - when { branch 'master' } - agent any - steps { - slackSend ( - color: '#00FF00', - message: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})", - channel: "#ops" - ) - } - } - stage('Build Docker image') { - agent any - steps { - script { - def dockerRepoName = 'zooniverse/thumbnailer' - def dockerImageName = "${dockerRepoName}:${GIT_COMMIT}" - def newImage = null - - newImage = docker.build(dockerImageName) - newImage.push() - - if (BRANCH_NAME == 'master') { - newImage.push('latest') - } - } - } - } - stage('Deploy to Kubernetes') { - when { branch 'master' } - agent any - steps { - sh "kubectl --context azure apply --record -f kubernetes/" - sh "sed 's/__IMAGE_TAG__/${GIT_COMMIT}/g' kubernetes/deployment.tmpl | kubectl --context azure apply --record -f -" - } - } - } - post { - success { - script { - if (BRANCH_NAME == 'master') { - slackSend ( - color: '#00FF00', - message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})", - channel: "#ops" - ) - } - } - } - - failure { - script { - if (BRANCH_NAME == 'master') { - slackSend ( - color: '#FF0000', - message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})", - channel: "#ops" - ) - } - } - } - } -} From f4b80364e4aaa86838ec4aa41bdd8d2274980a9f Mon Sep 17 00:00:00 2001 From: Zach Wolfenbarger Date: Mon, 29 Jan 2024 15:48:27 -0600 Subject: [PATCH 2/3] Deploy with GHA --- .github/workflows/deploy_app.yaml | 43 +++++++++++++++++++++++++++++++ kubernetes/deployment.tmpl | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_app.yaml diff --git a/.github/workflows/deploy_app.yaml b/.github/workflows/deploy_app.yaml new file mode 100644 index 0000000..b290a16 --- /dev/null +++ b/.github/workflows/deploy_app.yaml @@ -0,0 +1,43 @@ +name: Deploy to Production + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build_and_push_image: + name: Build and Push Image + uses: zooniverse/ci-cd/.github/workflows/build_and_push_image.yaml@main + with: + repo_name: thumbnailer + commit_id: ${{ github.sha }} + + deploy_production: + needs: build_and_push_image + name: Deploy to Production + uses: zooniverse/ci-cd/.github/workflows/deploy_app.yaml@main + with: + app_name: thumbnailer + repo_name: thumbnailer + commit_id: ${{ github.sha }} + environment: production + deploy_check: false + secrets: + creds: ${{ secrets.AZURE_AKS }} + + slack_notification: + name: Send Slack notification + uses: zooniverse/ci-cd/.github/workflows/slack_notification.yaml@main + needs: deploy_production + if: always() + with: + commit_id: ${{ github.sha }} + job_name: Deploy to Production / deploy_production + status: ${{ needs.deploy_production.result }} + # Customize the slack message + title: 'Thumbnailer production deploy complete' + title_link: 'thumbnails.zooniverse.org' + secrets: + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/kubernetes/deployment.tmpl b/kubernetes/deployment.tmpl index 1102c8f..7dd1df5 100644 --- a/kubernetes/deployment.tmpl +++ b/kubernetes/deployment.tmpl @@ -15,7 +15,7 @@ spec: spec: containers: - name: thumbnailer-nginx - image: zooniverse/thumbnailer:__IMAGE_TAG__ + image: ghcr.io/zooniverse/thumbnailer:__IMAGE_TAG__ resources: requests: memory: "150Mi" From ad6edf643c997863632f4fed63e5cad85f814f36 Mon Sep 17 00:00:00 2001 From: Zach Wolfenbarger Date: Wed, 31 Jan 2024 00:54:44 -0600 Subject: [PATCH 3/3] newline --- .github/workflows/deploy_app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_app.yaml b/.github/workflows/deploy_app.yaml index b290a16..d27a13e 100644 --- a/.github/workflows/deploy_app.yaml +++ b/.github/workflows/deploy_app.yaml @@ -40,4 +40,4 @@ jobs: title: 'Thumbnailer production deploy complete' title_link: 'thumbnails.zooniverse.org' secrets: - slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}