Skip to content

Commit d2b957b

Browse files
authored
Drone: Add release pipelines (grafana#28083)
* Drone: Implement release pipeline Signed-off-by: Arve Knudsen <[email protected]> * Drone: Implement test-release pipeline Signed-off-by: Arve Knudsen <[email protected]>
1 parent 61749de commit d2b957b

File tree

8 files changed

+2119
-345
lines changed

8 files changed

+2119
-345
lines changed

.circleci/config.yml

Lines changed: 3 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ version: 2.1
22

33
aliases:
44
# Workflow filters
5-
- &filter-only-release
6-
branches:
7-
only: chore/test-release-pipeline
8-
tags:
9-
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
105
- &filter-only-master
116
branches:
127
only: master
@@ -110,13 +105,6 @@ jobs:
110105
resource_class: large
111106
executor: grafana-build
112107
steps:
113-
- run:
114-
name: Exit if enterprise and forked PR
115-
command: |
116-
if [[ "<< parameters.edition >>" == "enterprise" && -n "$CIRCLE_PR_NUMBER" ]]; then
117-
echo "Nothing to do for forked PRs, so marking this step successful"
118-
circleci step halt
119-
fi
120108
- checkout
121109
- restore_cache:
122110
keys:
@@ -188,13 +176,8 @@ jobs:
188176
- run:
189177
name: Build internal Grafana plug-ins
190178
command: |
191-
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
192-
# This is a forked PR, so don't sign as it requires an API secret
193-
/tmp/grabpl build-plugins --jobs 2 --edition << parameters.edition >>
194-
else
195-
export GRAFANA_API_KEY=$GRAFANA_COM_API_KEY
196-
/tmp/grabpl build-plugins --jobs 2 --edition << parameters.edition >> --sign --signing-admin
197-
fi
179+
export GRAFANA_API_KEY=$GRAFANA_COM_API_KEY
180+
/tmp/grabpl build-plugins --jobs 2 --edition << parameters.edition >> --sign --signing-admin
198181
- run:
199182
name: Move artifacts
200183
command: |
@@ -341,38 +324,6 @@ jobs:
341324
command: "./scripts/ci-job-succeeded.sh"
342325
when: on_success
343326

344-
release-next-packages:
345-
executor: grafana-build
346-
steps:
347-
- run:
348-
name: Exit if forked PR
349-
command: |
350-
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
351-
echo "Nothing to do for forked PRs, so marking this step successful"
352-
circleci step halt
353-
fi
354-
- checkout
355-
- run:
356-
name: CI job started
357-
command: ./scripts/ci-job-started.sh
358-
- run:
359-
name: Bootstrap lerna
360-
command: npx lerna bootstrap
361-
- run:
362-
name: npm - Prepare auth token
363-
command: "echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc"
364-
- run:
365-
name: Release next packages
366-
command: ./scripts/circle-release-next-packages.sh
367-
- run:
368-
name: CI job failed
369-
command: ./scripts/ci-job-failed.sh
370-
when: on_fail
371-
- run:
372-
name: CI job succeeded
373-
command: ./scripts/ci-job-succeeded.sh
374-
when: on_success
375-
376327
package-oss:
377328
executor: grafana-build
378329
steps:
@@ -389,11 +340,6 @@ jobs:
389340
- run:
390341
name: Package Grafana
391342
command: |
392-
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
393-
echo Using test GPG key pair since building a forked PR
394-
source scripts/build/gpg-test-vars.sh
395-
fi
396-
397343
# Necessary for signing bundled plugins
398344
export GRAFANA_API_KEY=$GRAFANA_COM_API_KEY
399345
if [[ -n $CIRCLE_TAG ]]; then
@@ -528,11 +474,6 @@ jobs:
528474
yarn install --frozen-lockfile --no-progress
529475
yarn storybook:build
530476
531-
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
532-
echo "Nothing to do for forked PRs, so marking this step successful"
533-
circleci step halt
534-
fi
535-
536477
if [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
537478
# We're testing the release pipeline
538479
echo Testing release
@@ -830,9 +771,6 @@ jobs:
830771
elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
831772
# We're testing the release pipeline
832773
./scripts/circle-test-frontend.sh --edition << parameters.edition >> v7.0.0-test
833-
else
834-
# A master build
835-
./scripts/circle-test-frontend.sh --edition << parameters.edition >> --build-id $CIRCLE_WORKFLOW_ID
836774
fi
837775
- store_test_results:
838776
path: reports/junit
@@ -867,10 +805,6 @@ jobs:
867805
# We're testing the release pipeline
868806
/tmp/grabpl test-backend --github-token "${GITHUB_GRAFANABOT_TOKEN}" --edition << parameters.edition >> \
869807
v7.0.0-test
870-
else
871-
# A master build
872-
/tmp/grabpl test-backend --github-token "${GITHUB_GRAFANABOT_TOKEN}" --edition << parameters.edition >> \
873-
--build-id $CIRCLE_WORKFLOW_ID
874808
fi
875809
- run:
876810
name: CI job failed
@@ -881,45 +815,9 @@ jobs:
881815
command: "./scripts/ci-job-succeeded.sh"
882816
when: on_success
883817

884-
build-docs-website:
885-
executor: base
886-
steps:
887-
- checkout
888-
- setup_remote_docker
889-
- run:
890-
name: CI job started
891-
command: "./scripts/ci-job-started.sh"
892-
- run:
893-
name: Build Grafana docs website
894-
command: |
895-
# Use latest revision here, since we want to catch if it breaks
896-
IMAGE=grafana/docs-base:latest
897-
898-
# In order to copy sources into the remote container, we need to employ a trick of creating a container
899-
# with a volume, that we copy the sources into. Then, we launch the build container, with the volume
900-
# from the other container
901-
docker create -v /hugo/content/docs/grafana --name docs alpine:3.11 /bin/true
902-
docker cp ${PWD}/docs/sources docs:/hugo/content/docs/grafana/latest
903-
docker run --volumes-from docs $IMAGE /bin/bash -c 'make prod'
904-
- run:
905-
name: CI job failed
906-
command: "./scripts/ci-job-failed.sh"
907-
when: on_fail
908-
- run:
909-
name: CI job succeeded
910-
command: "./scripts/ci-job-succeeded.sh"
911-
when: on_success
912-
913818
release-packages:
914819
executor: node
915820
steps:
916-
- run:
917-
name: Exit if forked PR
918-
command: |
919-
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
920-
echo "Nothing to do for forked PRs, so marking this step successful"
921-
circleci step halt
922-
fi
923821
- checkout
924822
- run:
925823
name: CI job started
@@ -1223,7 +1121,7 @@ workflows:
12231121
requires:
12241122
- package-enterprise
12251123
- release-packages:
1226-
filters: *filter-only-release
1124+
filters: *filter-release
12271125
requires:
12281126
- end-to-end-tests
12291127
- mysql-integration-test

.drone.star

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
load('scripts/lib.star', 'pr_pipelines', 'master_pipelines')
1+
load('scripts/pr.star', 'pr_pipelines')
2+
load('scripts/master.star', 'master_pipelines')
3+
load('scripts/release.star', 'release_pipelines', 'test_release_pipelines')
24

35
def main(ctx):
46
edition = 'oss'
5-
return pr_pipelines(edition=edition) + master_pipelines(edition=edition)
7+
return pr_pipelines(edition=edition) + master_pipelines(edition=edition) + release_pipelines() + \
8+
test_release_pipelines()

0 commit comments

Comments
 (0)