Export DOCKER_CONFIG=/Users/cmoullia/.docker/config.json for testcon… #69
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: CI Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [macos-13, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Homebrew on Linux | |
if: matrix.os == 'ubuntu-latest' | |
uses: Homebrew/actions/setup-homebrew@master | |
- if: matrix.os == 'ubuntu-latest' | |
name: Remove old executable of crun and stop docker service | |
run: | | |
# Remove the old crun executable to let brew to install a newer one ... | |
sudo apt-get remove crun | |
sudo systemctl stop docker.socket | |
sudo systemctl stop docker | |
- name: Install podman v5 using homebrew | |
run: | | |
# What brew will install: https://ghcr.io/v2/homebrew/core/podman/manifests/5.3.2_1 | |
brew install podman | |
- name: Install and launch podman service | |
if: matrix.os == 'ubuntu-latest' | |
run: brew services start podman | |
- name: Create linux's vm on macos | |
if: matrix.os == 'macos-13' | |
run: | | |
podman machine init | |
# | |
# By default, the podman-mac-helper agent is not started and we could not use the following sock path: /var/run/docker.sock | |
# which is a symbolic link pointing to the VM's internal path shared with the host: /var/folders/28/g86pgjxj0wl1nkd_85c2krjw0000gn/T/podman/podman-machine-default.sock | |
# | |
# To access the socket from the host, then execute the following command: sudo podman-mac-helper install. | |
# | |
# Remark: It is enabled by default using podman desktop ! | |
# | |
sudo podman-mac-helper install | |
podman machine start --log-level debug | |
- name: Expose the podman API and podman.socket | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
podman system service --time=0 & | |
systemctl --user enable --now podman.socket | |
- name: Podman service status on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
systemctl status podman & | |
systemctl --user status podman.socket & | |
- name: Podman information | |
run: | | |
echo "Podman version: " $(podman info -f json | jq -r .version.Version) | |
echo "Podman rootless: " $(podman info -f json | jq -r .host.security.rootless) | |
echo "Podman sock path: " $(podman info -f json | jq -r .host.remoteSocket.path) | |
- name: Set DOCKER_HOST for linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "Podman sock path: unix://${XDG_RUNTIME_DIR}/podman/podman.sock" | |
echo "PODMAN_SOCK_PATH=unix://${XDG_RUNTIME_DIR}/podman/podman.sock" >> $GITHUB_ENV | |
- name: Set DOCKER_HOST for macos | |
if: matrix.os == 'macos-13' | |
run: | | |
# >> /run/user/501/podman/podman.sock - OK | |
#echo "Podman sock path: $(podman info -f json | jq -r .host.remoteSocket.path)" | |
#echo "PODMAN_SOCK_PATH=$(podman info -f json | jq -r .host.remoteSocket.path)" >> $GITHUB_ENV | |
# >> /var/run/docker.sock - OK | |
echo "Podman sock path: unix:///var/run/docker.sock" | |
echo "PODMAN_SOCK_PATH=unix:///var/run/docker.sock" >> $GITHUB_ENV | |
# >> /var/folders/28/g86pgjxj0wl1nkd_85c2krjw0000gn/T/podman/podman-machine-default.sock | |
# echo "Podman sock path: $(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')" | |
# echo PODMAN_SOCK_PATH=$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}') >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
run: | | |
podman login docker.io \ | |
-u ${{ vars.DOCKERHUB_USERNAME }} \ | |
-p ${{ secrets.DOCKERHUB_TOKEN }} \ | |
--compat-auth-file $HOME/.docker/config.json | |
#- name: Verify if there is a docker auth config file | |
# run: | | |
# echo "Check if there is a docker auth config file ..." | |
# cat $HOME/.docker/config.json | |
- uses: actions/checkout@v4 | |
with: | |
repository: ch007m/fork-kindcontainer.git | |
ref: enable-featuregate | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Build kindcontainer testcontainer project | |
id: build-kindcontainer | |
run: | | |
export SNAPSHOT_VERSION=$(gradle publishToMavenLocal --console=plain | grep 'Publishing to maven local' | awk -F':' '{print $NF}') | |
echo "SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> "$GITHUB_OUTPUT" | |
- run: | | |
echo Snapshot version of kind container: ${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: Build this project | |
run: | | |
mvn -B clean install \ | |
-Dno-format \ | |
-DskipTests \ | |
-Dtestcontainer.version=${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }} | |
- name: Perform CI test | |
env: | |
PODMAN_SOCK_PATH: ${{ env.PODMAN_SOCK_PATH }} | |
run: | | |
export TESTCONTAINERS_RYUK_DISABLED=true | |
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock | |
export DOCKER_HOST=$PODMAN_SOCK_PATH | |
export DOCKER_CONFIG=$HOME/.docker/config.json | |
mvn -B test -Dtest=ArgoCDDeployTest \ | |
-Dtestcontainer.version=${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }} |