Commit 756ad314 by Arve Knudsen Committed by GitHub

CircleCI: Skip enterprise builds for forked PRs (#22851)

* CircleCI: Skip enterprise builds for forked PRs
parent 6310aaff
......@@ -46,16 +46,12 @@ jobs:
executor: grafana-build
steps:
- run:
name: Clone repo
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
git clone -b v0.0.2 git@github.com:grafana/build-pipeline.git
- run:
name: Install Grafana Build Pipeline
command: |
cd build-pipeline
go build -o ../bin/grabpl ./cmd/grabpl
curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.0.3/grabpl
chmod +x grabpl
mkdir bin
mv grabpl bin/
- persist_to_workspace:
root: .
paths:
......@@ -70,6 +66,13 @@ jobs:
type: string
executor: grafana-build
steps:
- run:
name: Exit if enterprise and forked PR
command: |
if [[ "<< parameters.edition >>" == "enterprise" && -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -115,6 +118,13 @@ jobs:
type: string
executor: grafana-build
steps:
- run:
name: Exit if enterprise and forked PR
command: |
if [[ "<< parameters.edition >>" == "enterprise" && -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -227,6 +237,13 @@ jobs:
build-enterprise-windows-installer:
executor: windows-installer
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -259,6 +276,13 @@ jobs:
release-next-packages:
executor: grafana-build
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -298,6 +322,11 @@ jobs:
- run:
name: Package Grafana
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo Using test GPG key pair since building a forked PR
source scripts/build/gpg-test-vars.sh
fi
if [[ -n $CIRCLE_TAG ]]; then
# A release build
/tmp/workspace/bin/grabpl package --edition oss $CIRCLE_TAG
......@@ -333,6 +362,13 @@ jobs:
package-enterprise:
executor: grafana-build
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -384,6 +420,13 @@ jobs:
type: string
executor: grafana-publish
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -424,6 +467,12 @@ jobs:
command: |
yarn install --frozen-lockfile --no-progress
yarn storybook:build
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
if [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
echo Testing release
......@@ -455,6 +504,13 @@ jobs:
type: boolean
executor: docker
steps:
- run:
name: Exit if enterprise and forked PR
command: |
if [[ "<< parameters.edition >>" == "enterprise" && -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -474,11 +530,11 @@ jobs:
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 >> \
--ubuntu=<< parameters.ubuntu >> $CIRCLE_WORKFLOW_ID
--ubuntu=<< parameters.ubuntu >>
else
# We're testing a branch
/tmp/workspace/bin/grabpl build-docker --edition << parameters.edition >> \
--ubuntu=<< parameters.ubuntu >> --archs amd64 $CIRCLE_WORKFLOW_ID
--ubuntu=<< parameters.ubuntu >> --archs amd64
fi
mkdir -p << parameters.edition >>/docker
mv docker/*.tar << parameters.edition >>/docker/
......@@ -504,6 +560,13 @@ jobs:
type: boolean
executor: docker
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- attach_workspace:
at: /tmp/workspace
- checkout
......@@ -664,7 +727,7 @@ jobs:
steps:
- checkout
- run:
name: ci job started
name: CI job started
command: "./scripts/ci-job-started.sh"
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
......@@ -682,11 +745,11 @@ jobs:
- store_test_results:
path: reports/junit
- run:
name: ci job failed
name: CI job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
name: CI job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
......@@ -697,17 +760,17 @@ jobs:
steps:
- checkout
- run:
name: ci job started
name: CI job started
command: "./scripts/ci-job-started.sh"
- run:
name: build backend and run go tests
command: "./scripts/circle-test-backend.sh"
- run:
name: ci job failed
name: CI job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
name: CI job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
......@@ -719,15 +782,15 @@ jobs:
- checkout
- setup_remote_docker
- run:
name: ci job started
name: CI job started
command: "./scripts/ci-job-started.sh"
- run:
name: install docker
name: Install docker
command: |
apt-get update
apt-get install -y docker.io
- run:
name: build grafana docs website
name: Build grafana docs website
command: |
# https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
# create a dummy container which will hold a volume with config
......@@ -737,11 +800,11 @@ jobs:
# start an application container using this volume
docker run --volumes-from docs-website --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod'
- run:
name: ci job failed
name: CI job failed
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
name: CI job succeeded
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh"
when: on_success
......@@ -749,12 +812,19 @@ jobs:
docker:
- image: circleci/node:12
steps:
- run:
name: Exit if forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
- checkout
- run:
name: ci job started
name: CI job started
command: "./scripts/ci-job-started.sh"
- run:
name: Boostrap lerna
name: Bootstrap lerna
command: "npx lerna bootstrap"
- run:
name: npm - Prepare auth token
......@@ -763,11 +833,11 @@ jobs:
name: Release packages
command: ./scripts/build/release-packages.sh "${CIRCLE_TAG}"
- run:
name: ci job failed
name: CI job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
name: CI job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment