Skip to content

Commit

Permalink
CI: fix possible timeout bug
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed Feb 20, 2024
1 parent 207fa8b commit a7df145
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ jobs:

runs-on: ubuntu-latest
needs: setup
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 8
matrix:
distribution: ${{fromJSON(needs.setup.outputs.targets)}}
container_manager: ["podman"] #, "docker"]
Expand All @@ -85,9 +85,6 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Maximize build space
uses: ublue-os/remove-unwanted-software@v6

# Ensure distrobox create works:
- name: Distrobox create
shell: 'script -q -e -c "bash {0}"'
Expand All @@ -112,11 +109,6 @@ jobs:
run: |
image=${{ matrix.distribution }}
container_name="$(basename "${image}" | sed -E 's/[:.]/-/g')"
# ./distrobox enter --name "${container_name}" -- whoami
# Temporary disable systemd init on github runners, it seems to be incompatible
# with runner services:
# Failed to create /system.slice/runner-provisioner.service/init.scope control group: Permission denied
# works fine otherwise.
case "${container_name}" in
*init*)
echo "SYSTEMD DETECTED: performing systemctl check..."
Expand Down Expand Up @@ -208,8 +200,8 @@ jobs:
./distrobox stop --yes "${container_name}"
# Ensure distrobox rm works:
- name: Distrobox logs on failure
if: ${{ failure() }}
- name: Distrobox logs
if: ${{ always() }}
run: |
image=${{ matrix.distribution }}
container_name="$(basename "${image}" | sed -E 's/[:.]/-/g')"
Expand Down
7 changes: 2 additions & 5 deletions distrobox-enter
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,13 @@ if [ "${container_status}" != "running" ]; then
fi
# save starting loop timestamp in temp variable, we'll use it
# after to let logs command minimize possible holes
${container_manager} logs --since "${log_timestamp}" -f "${container_name}" \
> "${app_cache_dir}/.${container_name}.fifo" 2>&1 &
${container_manager} logs --since "${log_timestamp}" -f "${container_name}" 2> /dev/null \
> "${app_cache_dir}/.${container_name}.fifo" &
logs_pid="$!"

# read logs from log_timestamp to now, line by line
while IFS= read -r line; do
case "${line}" in
"+"*)
# Ignoring logging commands
;;
*"Error:"*)
printf >&2 "\033[31m %s\n\033[0m" "${line}"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion distrobox-init
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ fi
printf "distrobox: Ensuring user's access...\n"
# If we're rootless, delete password for root and user
if [ ! -e /etc/passwd.done ]; then
temporary_password="$(cat /proc/sys/kernel/random/uuid)"
temporary_password="$(md5sum < /proc/sys/kernel/random/uuid | cut -d' ' -f1)"
# We generate a random password to initialize the entry for the user.
printf "%s:%s" "${container_user_name}" "${temporary_password}" | chpasswd -e
printf "%s:" "${container_user_name}" | chpasswd -e
Expand Down

0 comments on commit a7df145

Please sign in to comment.