-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildspec.yml
More file actions
115 lines (103 loc) · 3.74 KB
/
buildspec.yml
File metadata and controls
115 lines (103 loc) · 3.74 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
version: 0.2
env:
shell: /bin/bash
variables:
USE_EPOCH: 1
PUBLIC_REGISTRY: public.ecr.aws/ews-network
DOCKER_CLI_EXPERIMENTAL: enabled
batch:
fast-fail: false
build-graph:
- identifier: amd64_py38
env:
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.8
buildspec: build_images.yml
- identifier: arm64v8_py38
env:
type: ARM_CONTAINER
image: aws/codebuild/amazonlinux2-aarch64-standard:2.0
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.8
buildspec: build_images.yml
- identifier: amd64_py39
env:
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.9
buildspec: build_images.yml
- identifier: arm64v8_py39
env:
type: ARM_CONTAINER
image: aws/codebuild/amazonlinux2-aarch64-standard:2.0
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.9
buildspec: build_images.yml
- identifier: amd64_py310
env:
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.10
buildspec: build_images.yml
- identifier: arm64v8_py310
env:
type: ARM_CONTAINER
image: aws/codebuild/amazonlinux2-aarch64-standard:2.0
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
variables:
VERSION: 3.10
buildspec: build_images.yml
- identifier: manifest
env:
compute-type: BUILD_GENERAL1_LARGE
privileged-mode: true
depend-on:
- amd64_py38
- arm64v8_py38
- amd64_py39
- arm64v8_py39
- amd64_py310
- arm64v8_py310
phases:
install:
commands:
- if [ -z ${AWS_ACCOUNT_ID+x} ]; then AWS_ACCOUNT_ID=$(aws sts get-caller-identity | jq -r .Account); fi
- REGISTRY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION:-$AWS_DEFAULT_REGION}.amazonaws.com/
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${REGISTRY_URI}
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${PUBLIC_REGISTRY}
- if ! [ -z ${CODEBUILD_RESOLVED_SOURCE_VERSION+x} ]; then COMMIT_HASH=${CODEBUILD_RESOLVED_SOURCE_VERSION::7}; fi
- EPOCH=`date +'%Y%m%d'`
- SUFFIX=${COMMIT_HASH:=$EPOCH}
- if [ $USE_EPOCH -eq 1 ]; then SUFFIX=$EPOCH; fi
build:
commands:
- |
for VERSION in 3.8 3.9 3.10; do
for ARCH in "x86_64" "aarch64"; do
TAG=${VERSION}.${SUFFIX}-${ARCH}
echo Publish from ${REGISTRY_URI}python:${TAG}$ to ${PUBLIC_REGISTRY}/python:${TAG}
docker pull ${REGISTRY_URI}python:${TAG}
docker tag ${REGISTRY_URI}python:${TAG} ${PUBLIC_REGISTRY}/python:${TAG}
docker push ${PUBLIC_REGISTRY}/python:${TAG}
done
docker manifest create ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX} \
--amend ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX}-x86_64 \
--amend ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX}-aarch64
docker manifest push ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX}
docker manifest create ${PUBLIC_REGISTRY}/python:${VERSION} \
--amend ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX}-x86_64 \
--amend ${PUBLIC_REGISTRY}/python:${VERSION}.${SUFFIX}-aarch64
docker manifest push ${PUBLIC_REGISTRY}/python:${VERSION}
done
finally:
- rm -rfv ~/.docker