CI: Remove grafana/drone-grafana-docker image (#44983)

* Remove grafana/drone-grafana-docker image

* Rename step

* Remove manual gcloud authentication

(cherry picked from commit 329b1a1ef3903c7e2c3ec1f286f9b0f00fcd023e)

* Add publish command for main

* Fix TAG variable parsing

* Remove shouldSave from main builds

* Reorder dependencies

* Update grabpl version
This commit is contained in:
Dimitris Sotirakis
2022-02-07 18:30:41 +01:00
committed by GitHub
parent a552e7323f
commit 5543ad883d
4 changed files with 164 additions and 150 deletions
+32 -25
View File
@@ -1,9 +1,8 @@
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
grabpl_version = 'v2.8.8'
grabpl_version = 'v2.8.9'
build_image = 'grafana/build-container:1.4.9'
publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
alpine_image = 'alpine:3.15'
curl_image = 'byrnedo/alpine-curl:0.1.8'
@@ -731,8 +730,11 @@ def copy_packages_for_docker_step():
}
def package_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False):
cmd = './bin/grabpl build-docker --edition {} --shouldSave'.format(edition)
def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False):
cmd = './bin/grabpl build-docker --edition {}'.format(edition)
if publish:
cmd += ' --shouldSave'
ubuntu_sfx = ''
if ubuntu:
ubuntu_sfx = '-ubuntu'
@@ -742,12 +744,10 @@ def package_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publ
cmd += ' -archs {}'.format(','.join(archs))
return {
'name': 'package-docker-images' + ubuntu_sfx,
'name': 'build-docker-images' + ubuntu_sfx,
'image': 'google/cloud-sdk',
'depends_on': ['copy-packages-for-docker'],
'commands': [
'printenv GCP_KEY | base64 -d > /tmp/gcpkey.json',
'gcloud auth activate-service-account --key-file=/tmp/gcpkey.json',
cmd
],
'volumes': [{
@@ -759,27 +759,34 @@ def package_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publ
},
}
def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False):
ubuntu_sfx = ''
if ubuntu:
ubuntu_sfx = '-ubuntu'
def publish_images_step(edition, ver_mode, mode, docker_repo, ubuntu=False):
if mode == 'security':
mode = '--{} '.format(mode)
else:
mode = ''
settings = {
'dry_run': not publish,
'edition': edition,
'ubuntu': ubuntu,
}
cmd = './bin/grabpl artifacts docker publish {}--dockerhub-repo {} --base alpine --base ubuntu --arch amd64 --arch arm64 --arch armv7'.format(mode, docker_repo)
if ver_mode == 'release':
deps = ['fetch-images-{}'.format(edition)]
cmd += ' --version-tag ${TAG}'
else:
deps = ['build-docker-images', 'build-docker-images-ubuntu']
if publish:
settings['username'] = from_secret('docker_user')
settings['password'] = from_secret('docker_password')
if archs:
settings['archs'] = ','.join(archs)
return {
'name': 'build-docker-images' + ubuntu_sfx,
'image': grafana_docker_image,
'depends_on': ['copy-packages-for-docker'],
'settings': settings,
'name': 'publish-images-{}'.format(docker_repo),
'image': 'google/cloud-sdk',
'environment': {
'GCP_KEY': from_secret('gcp_key'),
'DOCKER_USER': from_secret('docker_username'),
'DOCKER_PASSWORD': from_secret('docker_password'),
},
'commands': [cmd],
'depends_on': deps,
'volumes': [{
'name': 'docker',
'path': '/var/run/docker.sock'
}],
}