Skip to content

Commit 66cb56d

Browse files
authored
CI: Trigger tag on CI changes (grafana#55388)
* Trigger tag on CI changes * Use github token available for PRs Remove remote addition * Replace origin with full url Remove fetch for origin Fix fetch Remove --quite Add rebase Stash changes from verify-gen-cue Cleanup * Add --quiet when fetching
1 parent ef17f12 commit 66cb56d

File tree

4 files changed

+53
-52
lines changed

4 files changed

+53
-52
lines changed

.drone.yml

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,38 @@ steps:
356356
- grabpl
357357
image: grafana/build-container:1.6.3
358358
name: yarn-install
359+
- commands:
360+
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
361+
--depth=1
362+
- cd grafana-enterprise
363+
- git fetch origin "refs/tags/*:refs/tags/*" --quiet
364+
- if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
365+
push --delete origin $${TEST_TAG}; fi
366+
- git tag $${TEST_TAG} && git push origin $${TEST_TAG}
367+
- cd -
368+
- git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*"
369+
--quiet && git fetch --quiet
370+
- if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
371+
push --delete https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG};
372+
fi
373+
- git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git
374+
$${TEST_TAG}
375+
environment:
376+
DOWNSTREAM_REPO:
377+
from_secret: downstream
378+
GITHUB_TOKEN:
379+
from_secret: github_token_pr
380+
TEST_TAG: v0.0.0-test
381+
failure: ignore
382+
image: grafana/build-container:1.6.3
383+
name: trigger-test-release
384+
when:
385+
paths:
386+
include:
387+
- .drone.yml
388+
- pkg/build/**
389+
repo:
390+
- grafana/grafana
359391
- failure: ignore
360392
image: grafana/drone-downstream
361393
name: trigger-enterprise-downstream
@@ -1188,19 +1220,23 @@ steps:
11881220
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
11891221
--depth=1
11901222
- cd grafana-enterprise
1191-
- git fetch origin "refs/tags/*:refs/tags/*"
1192-
- git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG}
1193-
&& git push origin $${TEST_TAG}
1223+
- git fetch origin "refs/tags/*:refs/tags/*" --quiet
1224+
- if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
1225+
push --delete origin $${TEST_TAG}; fi
1226+
- git tag $${TEST_TAG} && git push origin $${TEST_TAG}
11941227
- cd -
1195-
- git fetch origin "refs/tags/*:refs/tags/*"
1196-
- git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git
1197-
- git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} &&
1198-
git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet
1228+
- git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*"
1229+
--quiet && git fetch --quiet
1230+
- if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
1231+
push --delete https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG};
1232+
fi
1233+
- git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git
1234+
$${TEST_TAG}
11991235
environment:
12001236
DOWNSTREAM_REPO:
12011237
from_secret: downstream
12021238
GITHUB_TOKEN:
1203-
from_secret: github_token
1239+
from_secret: github_token_pr
12041240
TEST_TAG: v0.0.0-test
12051241
failure: ignore
12061242
image: grafana/build-container:1.6.3
@@ -2204,9 +2240,6 @@ trigger:
22042240
- promote
22052241
ref:
22062242
- refs/tags/v*
2207-
repo:
2208-
exclude:
2209-
- grafana/grafana
22102243
type: docker
22112244
volumes:
22122245
- host:
@@ -2270,9 +2303,6 @@ trigger:
22702303
- promote
22712304
ref:
22722305
- refs/tags/v*
2273-
repo:
2274-
exclude:
2275-
- grafana/grafana
22762306
type: docker
22772307
volumes:
22782308
- host:
@@ -2339,9 +2369,6 @@ trigger:
23392369
- promote
23402370
ref:
23412371
- refs/tags/v*
2342-
repo:
2343-
exclude:
2344-
- grafana/grafana
23452372
type: docker
23462373
volumes:
23472374
- host:
@@ -2447,9 +2474,6 @@ trigger:
24472474
- promote
24482475
ref:
24492476
- refs/tags/v*
2450-
repo:
2451-
exclude:
2452-
- grafana/grafana
24532477
type: docker
24542478
volumes:
24552479
- host:
@@ -2520,9 +2544,6 @@ trigger:
25202544
- promote
25212545
ref:
25222546
- refs/tags/v*
2523-
repo:
2524-
exclude:
2525-
- grafana/grafana
25262547
type: docker
25272548
volumes:
25282549
- host:
@@ -2864,9 +2885,6 @@ trigger:
28642885
- promote
28652886
ref:
28662887
- refs/tags/v*
2867-
repo:
2868-
exclude:
2869-
- grafana/grafana
28702888
type: docker
28712889
volumes:
28722890
- host:
@@ -2957,9 +2975,6 @@ trigger:
29572975
- promote
29582976
ref:
29592977
- refs/tags/v*
2960-
repo:
2961-
exclude:
2962-
- grafana/grafana
29632978
type: docker
29642979
volumes:
29652980
- host:
@@ -3059,9 +3074,6 @@ trigger:
30593074
- promote
30603075
ref:
30613076
- refs/tags/v*
3062-
repo:
3063-
exclude:
3064-
- grafana/grafana
30653077
type: docker
30663078
volumes:
30673079
- host:
@@ -3161,9 +3173,6 @@ trigger:
31613173
- promote
31623174
ref:
31633175
- refs/tags/v*
3164-
repo:
3165-
exclude:
3166-
- grafana/grafana
31673176
type: docker
31683177
volumes:
31693178
- host:
@@ -3319,9 +3328,6 @@ trigger:
33193328
- promote
33203329
ref:
33213330
- refs/tags/v*
3322-
repo:
3323-
exclude:
3324-
- grafana/grafana
33253331
type: docker
33263332
volumes:
33273333
- host:
@@ -3412,9 +3418,6 @@ trigger:
34123418
- promote
34133419
ref:
34143420
- refs/tags/v*
3415-
repo:
3416-
exclude:
3417-
- grafana/grafana
34183421
type: docker
34193422
volumes:
34203423
- host:
@@ -5629,6 +5632,6 @@ kind: secret
56295632
name: packages_secret_access_key
56305633
---
56315634
kind: signature
5632-
hmac: 694dd8dd441da98425a1d41750ecfa2a6946f2329de2f321be734b031f9cc2e3
5635+
hmac: a8e4587efd7da775019ed2812c5980fb43fdb9ef5da50e2ac7e5c73151b6a685
56335636

56345637
...

scripts/drone/events/release.star

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ def release_pipelines(ver_mode='release', trigger=None):
445445
]
446446
},
447447
'ref': ['refs/tags/v*',],
448-
'repo': {
449-
'exclude': ['grafana/grafana'],
450-
},
451448
}
452449

453450
# The release pipelines include also enterprise ones, so both editions are built for a release.

scripts/drone/pipelines/build.star

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def build_e2e(trigger, ver_mode, edition):
5353
yarn_install_step(),
5454
]
5555
build_steps = []
56-
if ver_mode == 'main':
56+
if ver_mode == 'main' or ver_mode == 'pr':
5757
build_steps.extend([trigger_test_release()])
5858
if ver_mode == 'pr':
5959
build_steps.extend([enterprise_downstream_step(edition=edition, ver_mode=ver_mode)])

scripts/drone/steps/lib.star

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,19 +1202,20 @@ def trigger_test_release():
12021202
'name': 'trigger-test-release',
12031203
'image': build_image,
12041204
'environment': {
1205-
'GITHUB_TOKEN': from_secret('github_token'),
1205+
'GITHUB_TOKEN': from_secret('github_token_pr'),
12061206
'DOWNSTREAM_REPO': from_secret('downstream'),
12071207
'TEST_TAG': 'v0.0.0-test',
12081208
},
12091209
'commands': [
12101210
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" --depth=1',
12111211
'cd grafana-enterprise',
1212-
'git fetch origin "refs/tags/*:refs/tags/*"',
1213-
'git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG} && git push origin $${TEST_TAG}',
1212+
'git fetch origin "refs/tags/*:refs/tags/*" --quiet',
1213+
'if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG}; fi',
1214+
'git tag $${TEST_TAG} && git push origin $${TEST_TAG}',
12141215
'cd -',
1215-
'git fetch origin "refs/tags/*:refs/tags/*"',
1216-
'git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git',
1217-
'git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} && git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet',
1216+
'git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*" --quiet && git fetch --quiet',
1217+
'if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git push --delete https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG}; fi',
1218+
'git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG}',
12181219
],
12191220
'failure': 'ignore',
12201221
'when': {

0 commit comments

Comments
 (0)