diff --git a/.circleci/config.yml b/.circleci/config.yml index f3c5050277d..028197cf5ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,7 +48,7 @@ jobs: - run: name: Install Grafana Build Pipeline command: | - curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.2.4/grabpl + curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.2.5/grabpl chmod +x grabpl mkdir bin mv grabpl bin/ @@ -205,7 +205,6 @@ jobs: build-oss-windows-installer: executor: windows-installer - resource_class: large steps: - attach_workspace: at: /tmp/workspace @@ -238,7 +237,6 @@ jobs: build-enterprise-windows-installer: executor: windows-installer - resource_class: large steps: - run: name: Exit if forked PR @@ -312,7 +310,6 @@ jobs: package-oss: executor: grafana-build - resource_class: large steps: - attach_workspace: at: /tmp/workspace @@ -333,16 +330,16 @@ jobs: if [[ -n $CIRCLE_TAG ]]; then # A release build - /tmp/workspace/bin/grabpl package --edition oss $CIRCLE_TAG + /tmp/workspace/bin/grabpl package --jobs 4 --edition oss $CIRCLE_TAG elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then # We're testing the release pipeline - /tmp/workspace/bin/grabpl package --edition oss v6.7.0-beta1 + /tmp/workspace/bin/grabpl package --jobs 4 --edition oss v6.7.0-beta1 elif [[ $CIRCLE_BRANCH == "master" ]]; then # A master build - /tmp/workspace/bin/grabpl package --edition oss --build-id $CIRCLE_WORKFLOW_ID + /tmp/workspace/bin/grabpl package --jobs 4 --edition oss --build-id $CIRCLE_WORKFLOW_ID else # A PR build - /tmp/workspace/bin/grabpl package --edition oss --build-id $CIRCLE_WORKFLOW_ID --variants \ + /tmp/workspace/bin/grabpl package --jobs 4 --edition oss --build-id $CIRCLE_WORKFLOW_ID --variants \ linux-x64,linux-x64-musl,osx64,win64 fi - run: @@ -365,7 +362,6 @@ jobs: package-enterprise: executor: grafana-build - resource_class: large steps: - run: name: Exit if forked PR @@ -388,16 +384,16 @@ jobs: command: | if [[ -n $CIRCLE_TAG ]]; then # A release build - /tmp/workspace/bin/grabpl package --edition enterprise $CIRCLE_TAG + /tmp/workspace/bin/grabpl package --jobs 4 --edition enterprise $CIRCLE_TAG elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then # We're testing the release pipeline - /tmp/workspace/bin/grabpl package --edition enterprise v6.7.0-beta1 + /tmp/workspace/bin/grabpl package --jobs 4 --edition enterprise v6.7.0-beta1 elif [[ $CIRCLE_BRANCH == "master" ]]; then # A master build - /tmp/workspace/bin/grabpl package --edition enterprise --build-id $CIRCLE_WORKFLOW_ID + /tmp/workspace/bin/grabpl package --jobs 4 --edition enterprise --build-id $CIRCLE_WORKFLOW_ID else # A PR build - /tmp/workspace/bin/grabpl package --edition enterprise --build-id $CIRCLE_WORKFLOW_ID --variants \ + /tmp/workspace/bin/grabpl package --jobs 4 --edition enterprise --build-id $CIRCLE_WORKFLOW_ID --variants \ linux-x64,linux-x64-musl,osx64,win64 fi - run: @@ -420,7 +416,6 @@ jobs: publish-packages: description: "Publish packages" - resource_class: large parameters: edition: type: string @@ -502,8 +497,7 @@ jobs: when: on_success build-docker-images: - description: "Build Docker images" - resource_class: large + description: "Build/publish Docker images" parameters: edition: type: string @@ -536,64 +530,28 @@ jobs: command: | if [[ -n $CIRCLE_TAG || $CIRCLE_BRANCH == "chore/test-release-pipeline" || $CIRCLE_BRANCH == "master" ]]; then # It's a full build - /tmp/workspace/bin/grabpl build-docker --edition << parameters.edition >> \ + /tmp/workspace/bin/grabpl build-docker --jobs 4 --edition << parameters.edition >> \ --ubuntu=<< parameters.ubuntu >> else # We're testing a branch - /tmp/workspace/bin/grabpl build-docker --edition << parameters.edition >> \ + /tmp/workspace/bin/grabpl build-docker --jobs 4 --edition << parameters.edition >> \ --ubuntu=<< parameters.ubuntu >> --archs amd64 fi - mkdir -p << parameters.edition >>/docker - mv docker/*.tar << parameters.edition >>/docker/ - - persist_to_workspace: - root: . - paths: - - << parameters.edition >>/docker/*.tar - run: - name: CI job failed - command: ./scripts/ci-job-failed.sh - when: on_fail - - run: - name: CI job succeeded - command: ./scripts/ci-job-succeeded.sh - when: on_success - - publish-docker-images: - description: Publish Docker images - resource_class: large - parameters: - edition: - type: string - ubuntu: - type: boolean - executor: docker - steps: - - run: - name: Exit if forked PR + name: Exit if PR command: | - if [[ -n "$CIRCLE_PR_NUMBER" ]]; then - echo "Nothing to do for forked PRs, so marking this step successful" + if [[ -z $CIRCLE_TAG && $CIRCLE_BRANCH != "chore/test-release-pipeline" && $CIRCLE_BRANCH != "master" ]]; then + echo "Nothing to do for PRs, so marking this step successful" circleci step halt fi - - attach_workspace: - at: /tmp/workspace - - checkout - - run: - name: CI job started - command: ./scripts/ci-job-started.sh - - run: - name: Copy artifacts from workspace - command: | - cp -r /tmp/workspace/<< parameters.edition >>/docker . - cp -r /tmp/workspace/<< parameters.edition >>/dist . - run: name: Publish Docker images command: | if [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then # We're testing the release pipeline - /tmp/workspace/bin/grabpl publish-docker --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> --dry-run + /tmp/workspace/bin/grabpl publish-docker --jobs 4 --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> --dry-run else - /tmp/workspace/bin/grabpl publish-docker --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> + /tmp/workspace/bin/grabpl publish-docker --jobs 4 --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> fi - run: name: CI job failed @@ -605,7 +563,6 @@ jobs: when: on_success end-to-end-tests: - resource_class: large docker: - image: circleci/node:12-browsers steps: @@ -641,7 +598,6 @@ jobs: destination: logs mysql-integration-test: - resource_class: large docker: - image: circleci/golang:1.13.4 - image: circleci/mysql:5.6-ram @@ -673,7 +629,6 @@ jobs: when: on_success postgres-integration-test: - resource_class: large docker: - image: circleci/golang:1.13.4 - image: circleci/postgres:9.3-ram @@ -722,7 +677,6 @@ jobs: lint-go: docker: - image: circleci/golang:1.13.4 - resource_class: large working_directory: /go/src/github.com/grafana/grafana environment: # we need CGO because of go-sqlite3 @@ -756,7 +710,6 @@ jobs: -conf=./scripts/go/configs/gosec.json ./pkg/... test-frontend: - resource_class: large docker: - image: circleci/node:12 steps: @@ -932,6 +885,8 @@ workflows: name: build-oss-backend-armv6 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release edition: oss @@ -939,6 +894,8 @@ workflows: name: build-oss-backend-armv7 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release edition: oss @@ -946,6 +903,8 @@ workflows: name: build-oss-backend-armv7-musl requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release edition: oss @@ -953,6 +912,8 @@ workflows: name: build-oss-backend-arm64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release edition: oss @@ -960,6 +921,8 @@ workflows: name: build-oss-backend-arm64-musl requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches edition: oss @@ -967,6 +930,8 @@ workflows: name: build-oss-backend-osx64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches edition: oss @@ -974,6 +939,8 @@ workflows: name: build-oss-backend-win64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches edition: oss @@ -981,6 +948,8 @@ workflows: name: build-oss-backend-linux-x64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches edition: oss @@ -988,12 +957,16 @@ workflows: name: build-oss-backend-linux-x64-musl requires: - install-grabpl + - test-backend + - test-frontend - build-frontend: # No filters, meaning this job runs for all branches name: build-oss-frontend edition: oss requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release name: build-enterprise-backend-armv6 @@ -1001,6 +974,8 @@ workflows: variant: armv6 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release name: build-enterprise-backend-armv7 @@ -1008,6 +983,8 @@ workflows: variant: armv7 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release name: build-enterprise-backend-armv7-musl @@ -1015,6 +992,8 @@ workflows: variant: armv7-musl requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release name: build-enterprise-backend-arm64 @@ -1022,6 +1001,8 @@ workflows: variant: arm64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: filters: *filter-master-or-release name: build-enterprise-backend-arm64-musl @@ -1029,6 +1010,8 @@ workflows: variant: arm64-musl requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches name: build-enterprise-backend-osx64 @@ -1036,6 +1019,8 @@ workflows: variant: osx64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches name: build-enterprise-backend-win64 @@ -1043,6 +1028,8 @@ workflows: variant: win64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches name: build-enterprise-backend-linux-x64 @@ -1050,6 +1037,8 @@ workflows: variant: linux-x64 requires: - install-grabpl + - test-backend + - test-frontend - build-backend: # No filters, meaning this job runs for all branches name: build-enterprise-backend-linux-x64-musl @@ -1057,12 +1046,16 @@ workflows: variant: linux-x64-musl requires: - install-grabpl + - test-backend + - test-frontend - build-frontend: # No filters, meaning this job runs for all branches name: build-enterprise-frontend edition: enterprise requires: - install-grabpl + - test-backend + - test-frontend - build-release-publisher: filters: *filter-master-or-release - codespell: @@ -1091,11 +1084,15 @@ workflows: requires: - install-grabpl - lint-go + - test-backend + - test-frontend - postgres-integration-test: # No filters, meaning this job runs for all branches requires: - install-grabpl - lint-go + - test-backend + - test-frontend - package-oss: # No filters, meaning this job runs for all branches requires: @@ -1147,7 +1144,7 @@ workflows: - release-next-packages: filters: *filter-only-master requires: - - test-frontend + - end-to-end-tests - release-packages: filters: *filter-only-release requires: @@ -1170,13 +1167,17 @@ workflows: - build-enterprise-windows-installer - end-to-end-tests - build-release-publisher - - publish-storybook + - publish-storybook: + requires: + - test-backend + - test-frontend - build-docker-images: # No filters, meaning this job runs for all branches name: build-oss-docker-images edition: oss ubuntu: false requires: + - end-to-end-tests - package-oss - build-oss-windows-installer - build-docker-images: @@ -1185,6 +1186,7 @@ workflows: edition: oss ubuntu: true requires: + - end-to-end-tests - package-oss - build-oss-windows-installer - build-docker-images: @@ -1193,6 +1195,7 @@ workflows: edition: enterprise ubuntu: false requires: + - end-to-end-tests - package-enterprise - build-enterprise-windows-installer - build-docker-images: @@ -1201,50 +1204,22 @@ workflows: edition: enterprise ubuntu: true requires: + - end-to-end-tests - package-enterprise - build-enterprise-windows-installer - end-to-end-tests: # No filters, meaning this job runs for all branches requires: - package-oss - - publish-docker-images: - filters: *filter-master-or-release - name: publish-oss-docker-images - edition: oss - ubuntu: false - requires: - - build-oss-docker-images - - end-to-end-tests - - publish-docker-images: - filters: *filter-master-or-release - name: publish-oss-ubuntu-docker-images - edition: oss - ubuntu: true - requires: - - build-oss-ubuntu-docker-images - - end-to-end-tests - - publish-docker-images: - filters: *filter-master-or-release - name: publish-enterprise-docker-images - edition: enterprise - ubuntu: false - requires: - - build-enterprise-docker-images - - end-to-end-tests - - publish-docker-images: - filters: *filter-master-or-release - name: publish-enterprise-ubuntu-docker-images - edition: enterprise - ubuntu: true - requires: - - build-enterprise-ubuntu-docker-images - - end-to-end-tests - build-docs-website: filters: *filter-not-release-or-master + requires: + - mysql-integration-test + - postgres-integration-test - deploy-to-kubernetes: filters: *filter-only-master requires: - - publish-enterprise-docker-images + - build-enterprise-docker-images nightly: triggers: