Skip to content

Commit

Permalink
Fix push Docker steps (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
joanlopez authored Jan 11, 2023
1 parent feba9f6 commit 2685217
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 40 deletions.
32 changes: 17 additions & 15 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ steps:
depends_on:
- yarn-build

- name: publish_to_docker
- name: publish_to_docker_master
image: google/cloud-sdk:412.0.0
commands:
- sh scripts/build_push_docker.sh master
Expand Down Expand Up @@ -329,6 +329,20 @@ steps:
depends_on:
- yarn-build

- name: publish_to_github
image: cibuilds/github:0.13.0
commands:
- sh scripts/generate_md5sum.sh
- sh scripts/publish_github_release.sh
environment:
GITHUB_TOKEN:
from_secret: github_token
depends_on:
- package-linux-x64-glibc
- package-darwin-x64-unknown
- package-win32-x64-unknown
- package-linux-x64-glibc-no-chromium

- name: publish_to_docker
image: google/cloud-sdk:412.0.0
commands:
Expand All @@ -342,20 +356,8 @@ steps:
volumes:
- name: docker
path: /var/run/docker.sock

- name: publish_to_github
image: cibuilds/github:0.13.0
commands:
- sh scripts/generate_md5sum.sh
- sh scripts/publish_github_release.sh
environment:
GITHUB_TOKEN:
from_secret: github_token
depends_on:
- package-linux-x64-glibc
- package-darwin-x64-unknown
- package-win32-x64-unknown
- package-linux-x64-glibc-no-chromium
- publish_to_github

- name: publish_to_gcom
image: grafana/grafana-plugin-ci:1.6.1-alpine
Expand Down Expand Up @@ -433,6 +435,6 @@ get:

---
kind: signature
hmac: 36c52cfc80bf193859f112b30491d0eb811765cfe81cf0c047c154ca3ab4ec8f
hmac: 2f8b0d424bdf31b5cf14233702e70f2c3bc8297525d89d08810a049289551865

...
2 changes: 1 addition & 1 deletion scripts/drone/pipeline.star
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def promotion_pipeline():
}

steps = common_steps(False) + [
publish_to_docker_release(),
publish_gh_release(),
publish_to_docker_release(),
publish_to_gcom(),
]

Expand Down
48 changes: 24 additions & 24 deletions scripts/drone/promotion.star
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
load('scripts/drone/utils.star', 'docker_image', 'ci_image', 'publisher_image')
load('scripts/drone/vault.star', 'from_secret')

def publish_to_docker_master():
return publish_to_docker(master=True)

def publish_to_docker_release():
return publish_to_docker(master=False)

def publish_to_docker(master):
cmd = 'sh scripts/build_push_docker.sh'

if master:
cmd += ' master'

return {
'name': 'publish_to_docker',
'image': 'google/cloud-sdk:412.0.0',
'environment': {
'IMAGE_NAME': docker_image,
'DOCKER_USER': from_secret('docker_user'),
'DOCKER_PASS': from_secret('docker_pass'),
},
'commands': [cmd],
'volumes': [{'name': 'docker', 'path': '/var/run/docker.sock'}],
}

def publish_gh_release():
return {
'name': 'publish_to_github',
Expand All @@ -44,6 +20,30 @@ def publish_gh_release():
],
}

def publish_to_docker_master():
step = publish_to_docker()
step['name'] += '_master'
step['commands'][0] += ' master'
return step

def publish_to_docker_release():
step = publish_to_docker()
step['depends_on'] = ['publish_to_github']
return step

def publish_to_docker():
return {
'name': 'publish_to_docker',
'image': 'google/cloud-sdk:412.0.0',
'environment': {
'IMAGE_NAME': docker_image,
'DOCKER_USER': from_secret('docker_user'),
'DOCKER_PASS': from_secret('docker_pass'),
},
'commands': ['sh scripts/build_push_docker.sh'],
'volumes': [{'name': 'docker', 'path': '/var/run/docker.sock'}],
}

def publish_to_gcom():
return {
'name': 'publish_to_gcom',
Expand Down

0 comments on commit 2685217

Please sign in to comment.