Skip to content

Remove hard coded timeout from 180 to the field #103

Remove hard coded timeout from 180 to the field

Remove hard coded timeout from 180 to the field #103

Workflow file for this run

name: CI Build
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest,macos-13]
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 apt-get remove podman
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
# reconfigure timeouts for podman to be compatible with java docker api
sudo mkdir -p /etc/containers/containers.conf.d
printf "[engine]\nservice_timeout=91\n" | sudo tee -a /etc/containers/containers.conf.d/service-timeout.conf
# restart to allow config to take effect
brew services restart 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
# reconfigure timeouts inside podman vm to be compatible with java docker api
echo 'mkdir -p /etc/containers/containers.conf.d && printf "[engine]\nservice_timeout=91\n" > /etc/containers/containers.conf.d/service-timeout.conf && systemctl restart podman.socket' | podman machine ssh --username root --
- name: Expose the podman API and podman.socket
if: matrix.os == 'ubuntu-latest'
run: |
# As both commands do the same, then we will use instead systemd
# We got such an error without running the command: podman system service --time=0 &
# 2025-02-05 16:39:57,945 ERROR [tc.kin.31.0] (main) Could not start container: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"OCI runtime error","message":"runc: runc create failed: invalid mount \u0026{Source:/home/runner/.local/share/containers/storage/volumes/kindcontainer-0dac5552-cc4f-4317-a058-103456f8131e/_data Destination:/var/lib/containerd Device:bind Flags:20486 ClearedFlags:1 PropagationFlags:[278528] Data:nocopy Relabel: RecAttr:\u003cnil\u003e Extensions:0 IDMapping:\u003cnil\u003e}: bind mounts cannot have any filesystem-specific options applied: OCI runtime error","response":500}
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=${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=//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: Let's pull an image within the VM
if: matrix.os == 'macos-13'
run: |
echo "Let's pull an image ...."
podman machine ssh "podman pull kindest/node:v1.31.0 "
#- 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: 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 TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=$PODMAN_SOCK_PATH
export DOCKER_HOST=unix://$PODMAN_SOCK_PATH
export DOCKER_CONFIG=$HOME/.docker
export ARGOCD_RESOURCE_TIMEOUT=180
mvn -B test -Dtest=ArgoCDDeployTest \
-Dtestcontainer.version=${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }}
# | tee app.log
#- name: Get the log and extract the container id
# run: |
# CONTAINER_ID=$(grep -oE '[a-f0-9]{64}' app.log | tail -n1)
# echo "Extracted Container ID: $CONTAINER_ID"
# echo "CONTAINER_ID=$CONTAINER_ID" >> "$GITHUB_ENV"
# It raises an error as container don't exist anymore
# - name: Inspect Container if failure
# # if: failure()
# run: |
# echo "The extracted container ID is: $CONTAINER_ID"
# podman inspect $CONTAINER_ID