[docker] Cleanup, minor fixes, formula bump
[fuel.git] / mcp / patches / docker / 0001-OPNFV-tag-convention-alignment.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Mirantis Inc., Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Tue, 21 Aug 2018 02:42:35 +0200
11 Subject: [PATCH] OPNFV tag convention alignment
12
13 * (arch)- prefix Docker tags
14   Hacky implementation that only detects 'arm64', otherwise it will
15   default to 'amd64'.
16   Note that Docker arch notation uses 'arm64' instead of 'aarch64'.
17 * Override Docker tag to align with OPNFV format
18 * use Docker repository: opnfv/fuel
19
20 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
21 ---
22  invoke.yml | 2 +-
23  tasks.py   | 7 +++++--
24  2 files changed, 6 insertions(+), 3 deletions(-)
25
26 diff --git a/invoke.yml b/invoke.yml
27 index 0bd793e..291f4c7 100644
28 --- a/invoke.yml
29 +++ b/invoke.yml
30 @@ -65,7 +65,7 @@ target:
31
32  dockermake:
33    destination: 'images'
34 -  repository:  'docker.io/epcim/salt'
35 +  repository:  'docker.io/opnfv/fuel'
36    # options: '--no-cache'
37    # options: '--bust-cache reclass'
38    # options: '--registry-user epcim'
39 diff --git a/tasks.py b/tasks.py
40 index d6bf3bc..092c6e7 100644
41 --- a/tasks.py
42 +++ b/tasks.py
43 @@ -6,6 +6,7 @@ from invoke import Collection, task
44  from string import Template
45  import re
46  import ast
47 +import platform
48
49  # TODOs:
50  # - WIP - use namespace to expose images/targets as inoke tasks # image = Collection('image')
51 @@ -25,8 +26,9 @@ def all(ctx, dry=False, push=False, dry_targets=False, filter=None, **kwargs):
52                       dry=dry, push=push, dry_targets=dry_targets, filter=filter, **kwargs)
53
54  @task
55 -def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, **kwargs):
56 +def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, opnfv_tag='latest', push=False, dry=False, dry_targets=False, **kwargs):
57
58 +    kwargs['arch'] = 'arm64' if platform.machine() == 'aarch64' else 'amd64'
59      kwargs['dist'] = dist
60      kwargs['dist_rel'] = dist_rel
61      kwargs['dry'] = True if dry_targets or dry else False
62 @@ -35,6 +37,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None,
63      kwargs['require'] = require
64      kwargs['salt'] = salt
65      kwargs['target'] = target
66 +    kwargs['opnfv_tag'] = opnfv_tag
67      # command formating + update
68      fmt = {'tag': ''}
69      fmt.update(ctx.dockermake)
70 @@ -56,7 +59,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None,
71      # execute
72      cmd = Template("""
73              ${dry}docker-make -f DockerMake.${dist}.yml -u ${repository}: --name ${target} \
74 -            \t-t ${dist}-${dist_rel}${tag} \
75 +            \t-t ${arch}-${opnfv_tag} \
76              \t--requires ${requires} \
77              \t--build-arg SALT_VERSION="${salt}" \
78              \t--build-arg SALT_FORMULA_VERSION="${formula_rev}" \