File tree Expand file tree Collapse file tree 2 files changed +50
-28
lines changed Expand file tree Collapse file tree 2 files changed +50
-28
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,6 @@ workflows:
8
8
jobs :
9
9
- prepare-agents :
10
10
context : org-global
11
- # These are scratch images with a single binary (this is scanned on creation by execution) so I think we can do without scanning?
12
- # - scan-image:
13
- # context: org-global
14
- # requires:
15
- # - prepare-agents
16
11
- build-and-publish-images :
17
12
name : build-and-publish-image-amd64
18
13
context : org-global
@@ -25,18 +20,15 @@ workflows:
25
20
context : org-global
26
21
requires :
27
22
- prepare-agents
28
-
29
- executors :
30
- ccc :
31
- docker :
32
- - image : circleci/command-convenience:0.1
33
- auth :
34
- username : $DOCKER_HUB_USER
35
- password : $DOCKER_HUB_PASSWORD
36
- environment :
37
- NAME : << pipeline.parameters.release-name >>
38
- DOCKERFILE_PATH : Dockerfile
39
- TEAM : on-prem
23
+ - publish-manifest :
24
+ context : org-global
25
+ filters :
26
+ branches :
27
+ only :
28
+ - main
29
+ requires :
30
+ - build-and-publish-image-amd64
31
+ - build-and-publish-image-arm64
40
32
41
33
parameters :
42
34
release-name :
@@ -76,21 +68,21 @@ jobs:
76
68
at : .
77
69
- docker_login
78
70
- run : ./do build-docker-images << pipeline.parameters.release-name >> << parameters.arch >>
79
- # TODO: Publish images (on main) once the repo is set up
71
+ - when :
72
+ condition :
73
+ equal : [ main, << pipeline.git.branch >> ]
74
+ steps :
75
+ - run : ./do publish-docker-images << pipeline.parameters.release-name >> << parameters.arch >>
80
76
- notify_failing_main
81
77
82
- scan-image :
83
- executor : ccc
78
+ publish-manifest :
79
+ machine :
80
+ image : ubuntu-2204:2024.02.7
81
+ resource_class : small
84
82
steps :
85
83
- checkout
86
- - setup_remote_docker
87
- - attach_workspace :
88
- at : .
89
- - run :
90
- name : Scan Docker images
91
- command : scan
92
- - store_artifacts :
93
- path : ccc-image-scan-results
84
+ - docker_login
85
+ - run : ./do publish-docker-manifest << pipeline.parameters.release-name >>
94
86
- notify_failing_main
95
87
96
88
commands :
Original file line number Diff line number Diff line change @@ -33,6 +33,36 @@ build-docker-images() {
33
33
docker build -t circleci/" $repo " :test-agent-" $arch " --build-arg ARCH=" $arch " -f ./runner-init/fake-agent.Dockerfile .
34
34
}
35
35
36
+ # This variable is used, but shellcheck can't tell.
37
+ # shellcheck disable=SC2034
38
+ help_publish_docker_images=" Publish the runner init images"
39
+ publish-docker-images () {
40
+ repo=${1:? ' image repo name must be specified' }
41
+ arch=${2:? ' image arch must be specified' }
42
+
43
+ docker push circleci/" $repo " :agent-" $arch "
44
+ docker push circleci/" $repo " :test-agent-" $arch "
45
+ }
46
+
47
+ # This variable is used, but shellcheck can't tell.
48
+ # shellcheck disable=SC2034
49
+ help_publish_docker_manifest=" Publish the mutliarch manifest"
50
+ publish-docker-manifest () {
51
+ repo=${1:? ' image repo name must be specified' }
52
+
53
+ docker manifest create circleci/runner-init:agent \
54
+ --amend circleci/runner-init:agent-amd64 \
55
+ --amend circleci/runner-init:agent-arm64
56
+
57
+ docker manifest push circleci/runner-init:agent
58
+
59
+ docker manifest create circleci/runner-init:test-agent \
60
+ --amend circleci/runner-init:test-agent-amd64 \
61
+ --amend circleci/runner-init:test-agent-arm64
62
+
63
+ docker manifest push circleci/runner-init:test-agent
64
+ }
65
+
36
66
help-text-intro () {
37
67
echo "
38
68
DO
You can’t perform that action at this time.
0 commit comments