CI: Trigger tag on CI changes (#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
This commit is contained in:
Dimitris Sotirakis
2022-10-11 12:01:18 +03:00
committed by GitHub
parent ef17f12c23
commit 66cb56de79
4 changed files with 53 additions and 52 deletions
+45 -42
View File
@@ -356,6 +356,38 @@ steps:
- grabpl - grabpl
image: grafana/build-container:1.6.3 image: grafana/build-container:1.6.3
name: yarn-install name: yarn-install
- commands:
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
--depth=1
- cd grafana-enterprise
- git fetch origin "refs/tags/*:refs/tags/*" --quiet
- if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
push --delete origin $${TEST_TAG}; fi
- git tag $${TEST_TAG} && git push origin $${TEST_TAG}
- cd -
- git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*"
--quiet && git fetch --quiet
- 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
- git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git
$${TEST_TAG}
environment:
DOWNSTREAM_REPO:
from_secret: downstream
GITHUB_TOKEN:
from_secret: github_token_pr
TEST_TAG: v0.0.0-test
failure: ignore
image: grafana/build-container:1.6.3
name: trigger-test-release
when:
paths:
include:
- .drone.yml
- pkg/build/**
repo:
- grafana/grafana
- failure: ignore - failure: ignore
image: grafana/drone-downstream image: grafana/drone-downstream
name: trigger-enterprise-downstream name: trigger-enterprise-downstream
@@ -1188,19 +1220,23 @@ steps:
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
--depth=1 --depth=1
- cd grafana-enterprise - cd grafana-enterprise
- git fetch origin "refs/tags/*:refs/tags/*" - git fetch origin "refs/tags/*:refs/tags/*" --quiet
- git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG} - if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
&& git push origin $${TEST_TAG} push --delete origin $${TEST_TAG}; fi
- git tag $${TEST_TAG} && git push origin $${TEST_TAG}
- cd - - cd -
- git fetch origin "refs/tags/*:refs/tags/*" - git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*"
- git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git --quiet && git fetch --quiet
- git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} && - if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git
git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet push --delete https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG};
fi
- git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git
$${TEST_TAG}
environment: environment:
DOWNSTREAM_REPO: DOWNSTREAM_REPO:
from_secret: downstream from_secret: downstream
GITHUB_TOKEN: GITHUB_TOKEN:
from_secret: github_token from_secret: github_token_pr
TEST_TAG: v0.0.0-test TEST_TAG: v0.0.0-test
failure: ignore failure: ignore
image: grafana/build-container:1.6.3 image: grafana/build-container:1.6.3
@@ -2204,9 +2240,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2270,9 +2303,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2339,9 +2369,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2447,9 +2474,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2520,9 +2544,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2864,9 +2885,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -2957,9 +2975,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -3059,9 +3074,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -3161,9 +3173,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -3319,9 +3328,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -3412,9 +3418,6 @@ trigger:
- promote - promote
ref: ref:
- refs/tags/v* - refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker type: docker
volumes: volumes:
- host: - host:
@@ -5629,6 +5632,6 @@ kind: secret
name: packages_secret_access_key name: packages_secret_access_key
--- ---
kind: signature kind: signature
hmac: 694dd8dd441da98425a1d41750ecfa2a6946f2329de2f321be734b031f9cc2e3 hmac: a8e4587efd7da775019ed2812c5980fb43fdb9ef5da50e2ac7e5c73151b6a685
... ...
-3
View File
@@ -445,9 +445,6 @@ def release_pipelines(ver_mode='release', trigger=None):
] ]
}, },
'ref': ['refs/tags/v*',], 'ref': ['refs/tags/v*',],
'repo': {
'exclude': ['grafana/grafana'],
},
} }
# The release pipelines include also enterprise ones, so both editions are built for a release. # The release pipelines include also enterprise ones, so both editions are built for a release.
+1 -1
View File
@@ -53,7 +53,7 @@ def build_e2e(trigger, ver_mode, edition):
yarn_install_step(), yarn_install_step(),
] ]
build_steps = [] build_steps = []
if ver_mode == 'main': if ver_mode == 'main' or ver_mode == 'pr':
build_steps.extend([trigger_test_release()]) build_steps.extend([trigger_test_release()])
if ver_mode == 'pr': if ver_mode == 'pr':
build_steps.extend([enterprise_downstream_step(edition=edition, ver_mode=ver_mode)]) build_steps.extend([enterprise_downstream_step(edition=edition, ver_mode=ver_mode)])
+7 -6
View File
@@ -1202,19 +1202,20 @@ def trigger_test_release():
'name': 'trigger-test-release', 'name': 'trigger-test-release',
'image': build_image, 'image': build_image,
'environment': { 'environment': {
'GITHUB_TOKEN': from_secret('github_token'), 'GITHUB_TOKEN': from_secret('github_token_pr'),
'DOWNSTREAM_REPO': from_secret('downstream'), 'DOWNSTREAM_REPO': from_secret('downstream'),
'TEST_TAG': 'v0.0.0-test', 'TEST_TAG': 'v0.0.0-test',
}, },
'commands': [ 'commands': [
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" --depth=1', 'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" --depth=1',
'cd grafana-enterprise', 'cd grafana-enterprise',
'git fetch origin "refs/tags/*:refs/tags/*"', 'git fetch origin "refs/tags/*:refs/tags/*" --quiet',
'git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG} && git push origin $${TEST_TAG}', 'if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG}; fi',
'git tag $${TEST_TAG} && git push origin $${TEST_TAG}',
'cd -', 'cd -',
'git fetch origin "refs/tags/*:refs/tags/*"', 'git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*" --quiet && git fetch --quiet',
'git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git', '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',
'git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} && git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet', 'git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG}',
], ],
'failure': 'ignore', 'failure': 'ignore',
'when': { 'when': {