Daily automatic update #1690
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-22.04 | |
outputs: | |
strategy: ${{ steps.generate-jobs.outputs.strategy }} | |
steps: | |
- uses: actions/checkout@v4 | |
- 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-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- 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 | |
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 install --upgrade pip | |
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 | |
# Handling multiline GitHub Env | |
echo "BUILD-ARGS<<EOF" >> $GITHUB_ENV | |
echo "$ARGS" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
echo "TAGS=${RESULT%,}" >> $GITHUB_ENV | |
- name: Build ${{ matrix.name }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.dir }} | |
file: ${{ matrix.file }} | |
secrets: | | |
"cs_token=${{ secrets.CS_TOKEN }}" | |
"subscription=${{ secrets.SUBSCRIPTION }}" | |
push: false | |
provenance: false | |
tags: ${{ env.TAGS }} | |
load: true | |
build-args: | | |
SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }} | |
${{ env.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)"' | |
check: | |
if: always() | |
needs: | |
- generate-jobs | |
- test | |
name: Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/[email protected] | |
with: | |
jobs: ${{ toJSON(needs) }} |