-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathorb.yml
103 lines (99 loc) · 3.52 KB
/
orb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
version: 2.1
description: "Build utilities"
commands:
clone:
description: 'Clones the utilities repo into the current process'
parameters:
git_repo:
description: "Git repository to clone"
type: string
local_folder:
description: "Local folder path where the git repo will be cloned to"
type: string
steps:
- run:
name: Clone repo
command: |
mkdir << parameters.local_folder >>
git clone << parameters.git_repo >> << parameters.local_folder >>
chmod +x << parameters.local_folder >>/docker/build-image.sh
chmod +x << parameters.local_folder >>/docker/publish-manifest.sh
build:
description: 'Executes the build utility script to build docker images in the targeted processor architecture'
parameters:
architecture:
description: "Targeted processor architecture (amd64, arm64) desired"
type: string
image_name:
description: "Docker image name"
type: string
docker_registry:
description: "Docker registry"
type: string
docker_file:
description: "Docker file name + location"
type: string
clone_folder:
description: "Clone build-script folder"
type: string
default: $HOME/utilities
working_dir:
description: "Working folder to build the image"
type: string
steps:
- checkout
- clone:
git_repo: https://github.com/ovotech/ohs-build-scripts.git
local_folder: << parameters.clone_folder >>
- run:
name: Build image
working_directory: src
command: |
$HOME/utilities/docker/build-image.sh \
TARGET_ARCH=<< parameters.architecture >>\
NUGET_USERNAME=$NUGET_USERNAME\
NUGET_PASSWORD=$NUGET_PASSWORD\
DOCKERFILE=<< parameters.docker_file >>\
IMAGE_NAME=<< parameters.image_name >>\
DOCKER_REGISTRY=<< parameters.docker_registry >>\
WORKING_DIR=<< parameters.working_dir >>
save-image:
description: 'Saves container images to the circleci workspace'
parameters:
image_name:
description: "Docker image name to save"
type: string
path_name:
description: "Path name where the image will be saved"
type: string
root_name:
description: "Root folder name where the image will be saved"
type: string
steps:
- run:
name: Archive image
command: |
mkdir -p << parameters.root_name >>/<< parameters.path_name >>
docker save -o << parameters.root_name >>/<< parameters.path_name >>/<< parameters.image_name >>.tar << parameters.image_name >>
- persist_to_workspace:
root: << parameters.root_name >>
paths:
- << parameters.path_name >>
restore_images:
description: 'Restores container images saved in the workspace to the current docker context'
parameters:
path_name:
description: "Path name where the image will be loaded from"
type: string
root_name:
description: "Root folder name where the image will be loaded from"
type: string
steps:
- attach_workspace:
at: << parameters.root_name >>
- run:
name: Load images into docker
command: |
for i in /<< parameters.root_name >>/<< parameters.path_name >>/*.tar; do
docker load -i "$i"
done