Merge remote-tracking branch '2.0' into 3.0 #323
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
env: | |
DOCKER_BUILDKIT: "1" | |
COMPOSE_DOCKER_CLI_BUILD: "1" | |
BUILDKIT_PROGRESS: "plain" | |
NO_SQUASH: "" | |
NONINTERACTIVE: "1" | |
FORCE_ONLINE: "1" | |
RELEASABLE_REPOS: "^corpusops/" | |
RELEASABLE_BRANCHES: "^(refs/heads/)?(3.0)$" | |
jobs: | |
r: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set vars | |
run: |- | |
tags="${{matrix.image}}_preprovision-${{matrix.ansible_release}}" | |
rtags="${{matrix.image}}-${{matrix.ansible_release}}" | |
if [[ -n "${{matrix.ansible_latest}}" ]];then | |
if [[ "${{matrix.ansible_release }}" == "${{matrix.ansible_latest}}" ]];then | |
tags="$tags ${{matrix.image}}_preprovision" | |
rtags="$rtags ${{matrix.image}}" | |
fi | |
fi | |
if ( echo "$GITHUB_REF" | egrep -q "${RELEASABLE_BRANCHES}" ) \ | |
&& ( echo "$GITHUB_REPOSITORY" | egrep -q "${RELEASABLE_REPOS}" ) | |
then releasable=true;else releasable=false;fi | |
echo "releasable=$releasable" >> $GITHUB_OUTPUT | |
echo "tags=$tags" >> $GITHUB_OUTPUT | |
echo "rtags=$rtags" >> $GITHUB_OUTPUT | |
id: v | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Activate docker experimental | |
run: |- | |
sudo bash -exc "if [ ! -e /etc/docker/daemon.json ];then mkdir /etc/docker||true;echo '{}' > /etc/docker/daemon.json;fi;service docker stop;python -c \ | |
\"d='/etc/docker/daemon.json';\ | |
import json;c=json.load(open(d));c['experimental']=True;\ | |
open(d, 'w').write(json.dumps(c))\" | |
systemctl restart docker" | |
- uses: actions/checkout@v3 | |
- name: test installer & init DOTcorpusops | |
run: |- | |
set -ex | |
if [[ -n "${GITHUB_BASE_REF}" ]];then CORPUSOPS_BRANCH="$(git log HEAD|head -n1|awk '{print $2}')" | |
else CORPUSOPS_BRANCH="${GITHUB_REF//*\/}";fi | |
echo "Pinning corpusops branch/changeset: ${CORPUSOPS_BRANCH}" >&2 | |
mkdir .corpusops || true | |
echo $CORPUSOPS_BRANCH > .corpusops/corpusops_branch | |
# be sure not to have any cached role or collection | |
rm -rfv collection*/* roles/* || true | |
- name: Build image | |
id: docker_build2 | |
run: |- | |
set -ex | |
iid=$(mktemp) | |
img=${{matrix.image}}-${{matrix.ansible_release}} | |
docker build --iidfile $iid -f "docker/${img}" . --build-arg FORCE_ONLINE=1 --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from=$img | |
# preprovision tag is kept & so, then, pushed only for retrocompat. | |
for i in ${{steps.v.outputs.tags}} ${{steps.v.outputs.rtags}};do for t in $i;do docker tag $(cat $iid) $t;done;done | |
- name: Push images if needed | |
run: |- | |
set -ex;for i in ${{steps.v.outputs.tags}} ${{steps.v.outputs.rtags}};do docker push $i;done | |
if: ${{steps.v.outputs.releasable == 'true'}} | |
strategy: | |
fail-fast: false | |
matrix: | |
ansible_latest: ["2.14"] | |
ansible_release: | |
- "2.14" | |
image: | |
- "corpusops/ubuntu:22.04" | |
- "corpusops/ubuntu:20.04" | |
- "corpusops/debian:bullseye" | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
schedule: [{cron: '1 0 1,15 * *'}] | |