Skip to content

Commit

Permalink
generate tags
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Aug 29, 2022
1 parent 5c819e5 commit 5d74461
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ def main(ctx):
'amd64',
]

# image's base version
# For example, in latest's Dockerfile;
# FROM ubuntu:22.04
# then,
# 'latest': '22.04'
base_img_tag = {
'latest': 'u22.04',
'fedora': '36',
}

config = {
'version': 'latest',
'arch': 'amd64',
Expand All @@ -34,6 +44,16 @@ def main(ctx):
else:
config['path'] = '%s' % config['version']

config['tags'] = [config['version']]
if config['version'] == 'latest':
config['tags'].append(config['squishversion'][config['version']])
if config['version'] in base_img_tag:
config['tags'].append('%s-%s' % (base_img_tag[config['version']], config['squishversion'][config['version']]))
else:
config['tags'].append('%s-%s' % (config['version'], config['squishversion'][config['version']]))
if config['version'] in base_img_tag:
config['tags'].append('%s-%s-%s' % (config['version'], base_img_tag[config['version']], config['squishversion'][config['version']]))

stages.append(docker(config))

after = [
Expand Down Expand Up @@ -190,10 +210,7 @@ def dryrun(config):
},
'settings': {
'dry_run': True,
'tags': [
config['version'] + '-' + config['squishversion'][config['version']],
config['version'],
],
'tags': config['tags'],
'dockerfile': '%s/Dockerfile.%s' % (config['path'], config['arch']),
'repo': 'owncloudci/%s' % config['repo'],
'context': config['path'],
Expand Down Expand Up @@ -225,10 +242,7 @@ def publish(config):
'password': {
'from_secret': 'public_password',
},
'tags': [
config['version'] + '-' + config['squishversion'][config['version']],
config['version'],
],
'tags': config['tags'],
'dockerfile': '%s/Dockerfile.%s' % (config['path'], config['arch']),
'repo': 'owncloudci/%s' % config['repo'],
'context': config['path'],
Expand Down

0 comments on commit 5d74461

Please sign in to comment.