diff --git a/.github/workflows/deploy_app.yaml b/.github/workflows/deploy_app.yaml new file mode 100644 index 0000000..4f2c005 --- /dev/null +++ b/.github/workflows/deploy_app.yaml @@ -0,0 +1,28 @@ +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: prn-maps-api + commit_id: ${{ github.sha }} + latest: true + + deploy_production: + name: Deploy to Production + uses: zooniverse/ci-cd/.github/workflows/deploy_app.yaml@main + needs: build_and_push_image + with: + app_name: prn-maps-api + repo_name: prn-maps-api + commit_id: ${{ github.sha }} + environment: production + secrets: + creds: ${{ secrets.AZURE_AKS }} diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index cd97766..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,48 +0,0 @@ -#!groovy - -pipeline { - agent none - - options { - disableConcurrentBuilds() - } - - stages { - stage('Build Docker image') { - agent any - steps { - script { - def dockerRepoName = 'zooniverse/prn-maps-api' - def dockerImageName = "${dockerRepoName}:${GIT_COMMIT}" - def newImage = null - - newImage = docker.build(dockerImageName) - if (BRANCH_NAME == 'master') { - newImage.push() - } - } - } - } - 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 { - failure { - script { - if (BRANCH_NAME == 'master') { - slackSend ( - color: '#FF0000', - message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})", - channel: "#ops" - ) - } - } - } - } -} diff --git a/kubernetes/deployment.tmpl b/kubernetes/deployment-production.tmpl similarity index 96% rename from kubernetes/deployment.tmpl rename to kubernetes/deployment-production.tmpl index edcfa8f..f93a47e 100644 --- a/kubernetes/deployment.tmpl +++ b/kubernetes/deployment-production.tmpl @@ -18,7 +18,7 @@ spec: spec: containers: - name: prn-maps-api - image: zooniverse/prn-maps-api:__IMAGE_TAG__ + image: ghcr.io/zooniverse/prn-maps-api:__IMAGE_TAG__ resources: requests: memory: "100Mi"