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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 52 deletions

View File

@ -356,6 +356,38 @@ steps:
- grabpl
image: grafana/build-container:1.6.3
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
image: grafana/drone-downstream
name: trigger-enterprise-downstream
@ -1188,19 +1220,23 @@ steps:
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
--depth=1
- cd grafana-enterprise
- git fetch origin "refs/tags/*:refs/tags/*"
- git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG}
&& git push origin $${TEST_TAG}
- 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 origin "refs/tags/*:refs/tags/*"
- git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git
- git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} &&
git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet
- 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
from_secret: github_token_pr
TEST_TAG: v0.0.0-test
failure: ignore
image: grafana/build-container:1.6.3
@ -2204,9 +2240,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2270,9 +2303,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2339,9 +2369,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2447,9 +2474,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2520,9 +2544,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2864,9 +2885,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -2957,9 +2975,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -3059,9 +3074,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -3161,9 +3173,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -3319,9 +3328,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -3412,9 +3418,6 @@ trigger:
- promote
ref:
- refs/tags/v*
repo:
exclude:
- grafana/grafana
type: docker
volumes:
- host:
@ -5629,6 +5632,6 @@ kind: secret
name: packages_secret_access_key
---
kind: signature
hmac: 694dd8dd441da98425a1d41750ecfa2a6946f2329de2f321be734b031f9cc2e3
hmac: a8e4587efd7da775019ed2812c5980fb43fdb9ef5da50e2ac7e5c73151b6a685
...

View File

@ -445,9 +445,6 @@ def release_pipelines(ver_mode='release', trigger=None):
]
},
'ref': ['refs/tags/v*',],
'repo': {
'exclude': ['grafana/grafana'],
},
}
# The release pipelines include also enterprise ones, so both editions are built for a release.

View File

@ -53,7 +53,7 @@ def build_e2e(trigger, ver_mode, edition):
yarn_install_step(),
]
build_steps = []
if ver_mode == 'main':
if ver_mode == 'main' or ver_mode == 'pr':
build_steps.extend([trigger_test_release()])
if ver_mode == 'pr':
build_steps.extend([enterprise_downstream_step(edition=edition, ver_mode=ver_mode)])

View File

@ -1202,19 +1202,20 @@ def trigger_test_release():
'name': 'trigger-test-release',
'image': build_image,
'environment': {
'GITHUB_TOKEN': from_secret('github_token'),
'GITHUB_TOKEN': from_secret('github_token_pr'),
'DOWNSTREAM_REPO': from_secret('downstream'),
'TEST_TAG': 'v0.0.0-test',
},
'commands': [
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" --depth=1',
'cd grafana-enterprise',
'git fetch origin "refs/tags/*:refs/tags/*"',
'git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG} && git tag $${TEST_TAG} && git push origin $${TEST_TAG}',
'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 origin "refs/tags/*:refs/tags/*"',
'git remote add downstream https://$${GITHUB_TOKEN}@github.com/grafana/$${DOWNSTREAM_REPO}.git',
'git tag -d $${TEST_TAG} && git push --delete downstream --quiet $${TEST_TAG} && git tag $${TEST_TAG} && git push downstream $${TEST_TAG} --quiet',
'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}',
],
'failure': 'ignore',
'when': {