Drone: Use ${DRONE_TAG} in release pipelines, since it should work (#28299)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2020-10-16 12:54:41 +02:00 committed by GitHub
parent f989e37132
commit 392c5bdf73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 57 deletions

View File

@ -732,8 +732,7 @@ steps:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.18/grabpl
- chmod +x bin/grabpl
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl verify-version $${DRONE_TAG}
- ./bin/grabpl verify-version ${DRONE_TAG}
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
@ -799,8 +798,7 @@ steps:
- name: build-backend
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl build-backend --jobs 8 --edition oss --github-token $${GITHUB_TOKEN} --no-pull-enterprise $${DRONE_TAG}
- ./bin/grabpl build-backend --jobs 8 --edition oss --github-token $${GITHUB_TOKEN} --no-pull-enterprise ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -812,8 +810,7 @@ steps:
- name: build-frontend
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps --edition oss --no-pull-enterprise $${DRONE_TAG}
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps --edition oss --no-pull-enterprise ${DRONE_TAG}
depends_on:
- initialize
- test-frontend
@ -832,8 +829,7 @@ steps:
- name: package
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl package --jobs 8 --edition oss --github-token $${GITHUB_TOKEN} --no-pull-enterprise --sign $${DRONE_TAG}
- ./bin/grabpl package --jobs 8 --edition oss --github-token $${GITHUB_TOKEN} --no-pull-enterprise --sign ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -882,11 +878,10 @@ steps:
- name: publish-storybook
image: grafana/grafana-ci-deploy:1.2.6
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- printenv GCP_KEY | base64 -d > /tmp/gcpkey.json
- gcloud auth activate-service-account --key-file=/tmp/gcpkey.json
- gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/latest
- gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/$${DRONE_TAG}
- gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/${DRONE_TAG}
environment:
GCP_KEY:
from_secret: gcp_key
@ -961,8 +956,7 @@ steps:
commands:
- ./node_modules/.bin/lerna bootstrap
- echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./scripts/build/release-packages.sh $${DRONE_TAG}
- ./scripts/build/release-packages.sh ${DRONE_TAG}
environment:
NPM_TOKEN:
from_secret: npm_token
@ -1035,14 +1029,13 @@ steps:
- name: build-windows-installer
image: grafana/ci-wix:0.1.1
commands:
- $$env:DRONE_TAG=$$(.\grabpl.exe parse-tag-ref ${DRONE_TAG})
- $$gcpKey = $$env:GCP_KEY
- "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) > gcpkey.json"
- dos2unix gcpkey.json
- gcloud auth activate-service-account --key-file=gcpkey.json
- rm gcpkey.json
- cp C:\App\nssm-2.24.zip .
- .\grabpl.exe windows-installer --edition oss $$env:DRONE_TAG
- .\grabpl.exe windows-installer --edition oss ${DRONE_TAG}
- $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]
- gsutil cp $$fname gs://grafana-downloads/oss/release/
- gsutil cp "$$fname.sha256" gs://grafana-downloads/oss/release/
@ -1083,10 +1076,9 @@ steps:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.18/grabpl
- chmod +x bin/grabpl
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
- git checkout $${DRONE_TAG}
- git checkout ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -1094,14 +1086,13 @@ steps:
- name: initialize
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- mv bin/grabpl /tmp/
- rmdir bin
- mv grafana-enterprise /tmp/
- /tmp/grabpl init-enterprise /tmp/grafana-enterprise $${DRONE_TAG}
- /tmp/grabpl init-enterprise /tmp/grafana-enterprise ${DRONE_TAG}
- mkdir bin
- mv /tmp/grabpl bin/
- ./bin/grabpl verify-version $${DRONE_TAG}
- ./bin/grabpl verify-version ${DRONE_TAG}
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
@ -1169,8 +1160,7 @@ steps:
- name: build-backend
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl build-backend --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN} --no-pull-enterprise $${DRONE_TAG}
- ./bin/grabpl build-backend --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN} --no-pull-enterprise ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -1182,8 +1172,7 @@ steps:
- name: build-frontend
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps --edition enterprise --no-pull-enterprise $${DRONE_TAG}
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps --edition enterprise --no-pull-enterprise ${DRONE_TAG}
depends_on:
- initialize
- test-frontend
@ -1202,8 +1191,7 @@ steps:
- name: package
image: grafana/build-container:1.2.28
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl package --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN} --no-pull-enterprise --sign $${DRONE_TAG}
- ./bin/grabpl package --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN} --no-pull-enterprise --sign ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -1370,10 +1358,9 @@ steps:
commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.18/windows/grabpl.exe -OutFile grabpl.exe
- $$env:DRONE_TAG=$$(.\grabpl.exe parse-tag-ref ${DRONE_TAG})
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
- git checkout $$env:DRONE_TAG
- git checkout ${DRONE_TAG}
environment:
GITHUB_TOKEN:
from_secret: github_token
@ -1393,14 +1380,13 @@ steps:
- name: build-windows-installer
image: grafana/ci-wix:0.1.1
commands:
- $$env:DRONE_TAG=$$(.\grabpl.exe parse-tag-ref ${DRONE_TAG})
- $$gcpKey = $$env:GCP_KEY
- "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) > gcpkey.json"
- dos2unix gcpkey.json
- gcloud auth activate-service-account --key-file=gcpkey.json
- rm gcpkey.json
- cp C:\App\nssm-2.24.zip .
- .\grabpl.exe windows-installer --edition enterprise $$env:DRONE_TAG
- .\grabpl.exe windows-installer --edition enterprise ${DRONE_TAG}
- $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]
- gsutil cp $$fname gs://grafana-downloads/enterprise/release/
- gsutil cp "$$fname.sha256" gs://grafana-downloads/enterprise/release/
@ -1438,17 +1424,15 @@ steps:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.18/grabpl
- chmod +x bin/grabpl
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl verify-version $${DRONE_TAG}
- ./bin/grabpl verify-version ${DRONE_TAG}
environment:
DOCKERIZE_VERSION: 0.6.1
- name: publish-packages
image: grafana/grafana-ci-deploy:1.2.6
commands:
- export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})
- ./bin/grabpl publish-packages --edition oss $${DRONE_TAG}
- ./bin/grabpl publish-packages --edition enterprise $${DRONE_TAG}
- ./bin/grabpl publish-packages --edition oss ${DRONE_TAG}
- ./bin/grabpl publish-packages --edition enterprise ${DRONE_TAG}
environment:
GRAFANA_COM_API_KEY:
from_secret: grafana_api_key

View File

@ -8,8 +8,6 @@ dockerize_version = '0.6.1'
wix_image = 'grafana/ci-wix:0.1.1'
test_release_ver = 'v7.3.0-test'
drone_tag_cmd = 'export DRONE_TAG=$$(./bin/grabpl parse-tag-ref ${DRONE_COMMIT_REF})'
def pipeline(
name, edition, trigger, steps, ver_mode, services=[], platform='linux', depends_on=[],
is_downstream=False, install_deps=True,
@ -100,8 +98,7 @@ def init_steps(edition, platform, ver_mode, is_downstream=False, install_deps=Tr
pre_cmds = []
if ver_mode == 'release':
pre_cmds.append(drone_tag_cmd)
common_cmds.append('./bin/grabpl verify-version $${DRONE_TAG}')
common_cmds.append('./bin/grabpl verify-version ${DRONE_TAG}')
elif ver_mode == 'test-release':
common_cmds.append('./bin/grabpl verify-version {}'.format(test_release_ver))
@ -122,8 +119,8 @@ def init_steps(edition, platform, ver_mode, is_downstream=False, install_deps=Tr
])
if edition == 'enterprise':
if ver_mode == 'release':
committish = '$${DRONE_TAG}'
source_commit = ' $${DRONE_TAG}'
committish = '${DRONE_TAG}'
source_commit = ' ${DRONE_TAG}'
elif ver_mode == 'test-release':
committish = 'master'
source_commit = ''
@ -283,8 +280,7 @@ def publish_storybook_step(edition, ver_mode):
else:
commands = []
if ver_mode == 'release':
channels = ['latest', '$${DRONE_TAG}',]
commands.append(drone_tag_cmd)
channels = ['latest', '${DRONE_TAG}',]
else:
channels = ['canary',]
commands.extend([
@ -323,8 +319,7 @@ def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
},
}
cmds = [
drone_tag_cmd,
'./bin/grabpl build-backend --jobs 8 --edition {} --github-token $${{GITHUB_TOKEN}} --no-pull-enterprise $${{DRONE_TAG}}'.format(
'./bin/grabpl build-backend --jobs 8 --edition {} --github-token $${{GITHUB_TOKEN}} --no-pull-enterprise ${{DRONE_TAG}}'.format(
edition,
),
]
@ -372,9 +367,8 @@ def build_frontend_step(edition, ver_mode, is_downstream=False):
# TODO: Use percentage for num jobs
if ver_mode == 'release':
cmds = [
drone_tag_cmd,
'./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps ' + \
'--edition {} --no-pull-enterprise $${{DRONE_TAG}}'.format(edition),
'--edition {} --no-pull-enterprise ${{DRONE_TAG}}'.format(edition),
]
elif ver_mode == 'test-release':
cmds = [
@ -557,9 +551,8 @@ def package_step(edition, ver_mode, variants=None, is_downstream=False):
# TODO: Use percentage for jobs
if ver_mode == 'release':
cmds = [
drone_tag_cmd,
'{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} $${{DRONE_TAG}}'.format(
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} ${{DRONE_TAG}}'.format(
sign_args
),
]
@ -847,8 +840,6 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
source_commit = ' $$env:SOURCE_COMMIT'
pre_cmds = []
if ver_mode == 'release':
pre_cmds.append('$$env:DRONE_TAG=$$(.\\grabpl.exe parse-tag-ref ${DRONE_TAG})')
sfx = ''
if edition == 'enterprise':
sfx = '-enterprise'
@ -869,7 +860,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
bucket_part = ''
bucket = 'grafana-downloads'
if ver_mode == 'release':
ver_part = '$$env:DRONE_TAG'
ver_part = '${DRONE_TAG}'
dir = 'release'
elif ver_mode == 'test-release':
ver_part = test_release_ver
@ -912,7 +903,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
if edition == 'enterprise':
if ver_mode == 'release':
committish = '$$env:DRONE_TAG'
committish = '${DRONE_TAG}'
elif ver_mode == 'test-release':
committish = 'master'
else:

View File

@ -29,7 +29,6 @@ load(
'publish_packages_step',
'notify_pipeline',
'integration_test_services',
'drone_tag_cmd',
)
def release_npm_packages_step(edition, ver_mode):
@ -41,7 +40,7 @@ def release_npm_packages_step(edition, ver_mode):
'echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc',
]
if ver_mode == 'release':
commands.extend([drone_tag_cmd, './scripts/build/release-packages.sh $${DRONE_TAG}',])
commands.append('./scripts/build/release-packages.sh ${DRONE_TAG}')
return {
'name': 'release-npm-packages',
@ -140,9 +139,8 @@ def release_pipelines():
},
},
'commands': [
drone_tag_cmd,
'./bin/grabpl publish-packages --edition oss $${DRONE_TAG}',
'./bin/grabpl publish-packages --edition enterprise $${DRONE_TAG}',
'./bin/grabpl publish-packages --edition oss ${DRONE_TAG}',
'./bin/grabpl publish-packages --edition enterprise ${DRONE_TAG}',
],
},
], depends_on=[p['name'] for p in oss_pipelines + enterprise_pipelines], install_deps=False,