-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (83 loc) · 3.17 KB
/
ci.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
name: Continuous Integration
on:
push:
schedule:
- cron: 0 0 * * 0
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
env:
IMAGE_NAME: docker-postgresql
jobs:
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-20.04
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- uses: actions/checkout@v2
- id: generate-jobs
name: Generate Jobs
run: .github/generate-strategy.sh -i
test:
needs: generate-jobs
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: PostgreSQL ${{ matrix.name }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Prepare Environment
run: |
git clone --depth 1 https://github.com/docker-library/official-images.git -b master ~/oi
# create a dummy empty image/layer so we can --filter since= later to get a meaningful image list
{ echo FROM busybox:latest; echo RUN :; } | docker build --no-cache --tag image-list-marker -
# PGP Happy Eyeballs
git clone --depth 1 https://github.com/tianon/pgp-happy-eyeballs.git ~/phe
~/phe/hack-my-builds.sh
rm -rf ~/phe
- name: Docker meta
id: docker-meta
env:
BUILD_ARGS: ${{ toJson(matrix.build_args) }}
TAGS: ${{ toJson(matrix.tags) }}
run: |
ARGS=""
# Only Ironbank builds use build-args. We get here the packages
# required in the case
if [[ "${BUILD_ARGS}" != "null" ]]; then
ARGS+=$(echo "${BUILD_ARGS}" | jq -r '. | "BASE_REGISTRY=\(.BASE_REGISTRY)\nBASE_IMAGE=\(.BASE_IMAGE)"')
for u in $(cat "${{ matrix.dir }}/urls.txt")
do curl -fsSL -o "${{ matrix.dir}}"/$(basename $u) $u
done
python3 -m pip download -r "${{ matrix.dir }}/requirements.txt" -d "${{ matrix.dir }}"
fi
RESULT=""
for tag in $(jq -r '.[]' <<< "${TAGS}")
do
RESULT="${RESULT},${IMAGE_NAME}:${tag}"
done
ARGS="${ARGS//'%'/'%25'}"
ARGS="${ARGS//$'\n'/'%0A'}"
ARGS="${ARGS//$'\r'/'%0D'}"
echo "::set-output name=build-args::${ARGS}"
echo "::set-output name=tags::${RESULT%,}"
- name: Build ${{ matrix.name }}
uses: docker/build-push-action@v2.7.0
with:
context: ${{ matrix.dir }}
file: ${{ matrix.file }}
secrets: |
"cs_script=${{ secrets.CS_SCRIPT }}"
push: false
tags: ${{ steps.docker-meta.outputs.tags }}
load: true
build-args: |
${{ steps.docker-meta.outputs.build-args }}
- name: History ${{ matrix.name }}
run: docker history "${IMAGE_NAME}:${{ matrix.tags[0] }}"
- name: Test ${{ matrix.name }}
run: ~/oi/test/run.sh "${IMAGE_NAME}:${{ matrix.tags[0] }}"
- name: '"docker images"'
run: docker image ls --filter since=image-list-marker
- name: docker images labels
run: docker image ls --filter since=image-list-marker --format "{{.Repository}}:{{.Tag}}" | xargs docker inspect | jq -r '.[] | "\(.RepoTags[]) \(.Config.Labels)"'