fix broken Docker build and helm package
This commit is contained in:
parent
06b65a7882
commit
edfe0e5450
|
@ -52,7 +52,7 @@ package-docker:
|
|||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
before_script:
|
||||
- echo "{\"auths\":{\"https://docker.$NEXUS_URL/\":{\"username\":\"$NEXUS_USER\",\"password\":\"$NEXUS_PASS\"}}}" > /kaniko/.docker/config.json
|
||||
- echo "{\"auths\":{\"docker.$NEXUS_URL\":{\"auth\":\"$NEXUS_AUTH\"}}}" > /kaniko/.docker/config.json
|
||||
script:
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.pkg.beryju.org/passbook:latest --destination docker.pkg.beryju.org/passbook:0.0.8-alpha
|
||||
stage: build
|
||||
|
@ -65,7 +65,7 @@ package-helm:
|
|||
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
|
||||
- helm init --client-only
|
||||
- helm package helm/passbook
|
||||
- ./manage.py nexus_upload --method put --url $NEXUS_URL --user $NEXUS_USER --password $NEXUS_PASS --repo helm *.tgz
|
||||
- ./manage.py nexus_upload --method put --url $NEXUS_URL --auth $NEXUS_AUTH --repo helm *.tgz
|
||||
only:
|
||||
- tags
|
||||
- /^version/.*$/
|
||||
|
|
|
@ -2,5 +2,5 @@ apiVersion: v1
|
|||
appVersion: "0.0.8-alpha"
|
||||
description: A Helm chart for passbook.
|
||||
name: passbook
|
||||
version: 1.0.0
|
||||
version: "0.0.8-alpha"
|
||||
icon: https://passbook.beryju.org/images/logo.png
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""passbook nexus_upload management command"""
|
||||
from getpass import getpass
|
||||
from base64 import b64decode
|
||||
|
||||
import requests
|
||||
from django.core.management.base import BaseCommand
|
||||
|
@ -24,9 +24,9 @@ class Command(BaseCommand):
|
|||
help='Nexus root URL',
|
||||
required=True)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
'--auth',
|
||||
action='store',
|
||||
help='Username to use for Nexus upload',
|
||||
help='base64-encoded string of username:password',
|
||||
required=True)
|
||||
parser.add_argument(
|
||||
'--method',
|
||||
|
@ -37,29 +37,21 @@ class Command(BaseCommand):
|
|||
help=('Method used for uploading files to nexus. '
|
||||
'Apt repositories use post, Helm uses put.'),
|
||||
required=True)
|
||||
parser.add_argument(
|
||||
'--password',
|
||||
action='store',
|
||||
help=("Password to use for Nexus upload. "
|
||||
"If parameter not given, we'll interactively ask"))
|
||||
# Positional arguments
|
||||
parser.add_argument('file', nargs='+', type=str)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
"""Upload debian package to nexus repository"""
|
||||
if options.get('password') is None:
|
||||
options['password'] = getpass()
|
||||
auth = tuple(b64decode(options.get('auth')).decode('utf-8').split(':', 1))
|
||||
responses = {}
|
||||
url = 'https://%(url)s/repository/%(repo)s//' % options
|
||||
url = 'https://%(url)s/repository/%(repo)s/' % options
|
||||
method = options.get('method')
|
||||
exit_code = 0
|
||||
for file in options.get('file'):
|
||||
if method == 'post':
|
||||
responses[file] = requests.post(url, data=open(file, mode='rb'),
|
||||
auth=(options.get('user'), options.get('password')))
|
||||
responses[file] = requests.post(url, data=open(file, mode='rb'), auth=auth)
|
||||
else:
|
||||
responses[file] = requests.put(url+file, data=open(file, mode='rb'),
|
||||
auth=(options.get('user'), options.get('password')))
|
||||
responses[file] = requests.put(url+file, data=open(file, mode='rb'), auth=auth)
|
||||
self.stdout.write('Upload results:\n')
|
||||
sep = '-' * 60
|
||||
self.stdout.write('%s\n' % sep)
|
||||
|
|
Reference in New Issue