From f04d0e4ead3771502e7edbf2e5180b697e4f4c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 23 Apr 2024 10:12:36 +0200 Subject: [PATCH] GitHub Action: bind mount /usr/bin/gh into the containers We use the `gh` GitHub command line tool to create pull requests. The tool is installed inside the Tumbleweed container using `zypper` as usually. The problem is that the installation might fail in some cases (GPG key problem, network error,...) and this fails whole action. But we actually do not need to install the tool, it already is pre-installed in the default Ubuntu host system. And because the `gh` tool is a statically linked binary without any dependencies we can simply just bind mount it from the host inside the container without any installation. --- .github/workflows/weblate-merge-po.yml | 10 ++++++---- .github/workflows/weblate-merge-products-po.yml | 10 ++++++---- .github/workflows/weblate-merge-service-po.yml | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/weblate-merge-po.yml b/.github/workflows/weblate-merge-po.yml index bcf87d1556..6c0d46ad29 100644 --- a/.github/workflows/weblate-merge-po.yml +++ b/.github/workflows/weblate-merge-po.yml @@ -22,18 +22,20 @@ jobs: container: image: registry.opensuse.org/opensuse/tumbleweed:latest + volumes: + # bind mount the GitHub CLI tool from the Ubuntu host, + # it is a statically linked binary so it should work also in TumbleWeed + - /usr/bin/gh:/usr/bin/gh steps: - name: Configure and refresh repositories run: | - # install the GitHub command line tool "gh" - zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo # disable unused repositories to have a faster refresh zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \ - zypper --non-interactive --gpg-auto-import-keys ref + zypper --non-interactive ref - name: Install tools - run: zypper --non-interactive install --no-recommends gh git gettext-tools python3-langtable + run: zypper --non-interactive install --no-recommends git gettext-tools python3-langtable - name: Configure Git run: | diff --git a/.github/workflows/weblate-merge-products-po.yml b/.github/workflows/weblate-merge-products-po.yml index 4d722e3230..2f08620718 100644 --- a/.github/workflows/weblate-merge-products-po.yml +++ b/.github/workflows/weblate-merge-products-po.yml @@ -22,18 +22,20 @@ jobs: container: image: registry.opensuse.org/opensuse/tumbleweed:latest + volumes: + # bind mount the GitHub CLI tool from the Ubuntu host, + # it is a statically linked binary so it should work also in TumbleWeed + - /usr/bin/gh:/usr/bin/gh steps: - name: Configure and refresh repositories run: | - # install the GitHub command line tool "gh" - zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo # disable unused repositories to have a faster refresh zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \ - zypper --non-interactive --gpg-auto-import-keys ref + zypper --non-interactive ref - name: Install tools - run: zypper --non-interactive install --no-recommends gh git gettext-tools npm-default + run: zypper --non-interactive install --no-recommends git gettext-tools npm-default - name: Configure Git run: | diff --git a/.github/workflows/weblate-merge-service-po.yml b/.github/workflows/weblate-merge-service-po.yml index 627b048d12..615b3f5bd1 100644 --- a/.github/workflows/weblate-merge-service-po.yml +++ b/.github/workflows/weblate-merge-service-po.yml @@ -24,7 +24,7 @@ jobs: image: registry.opensuse.org/opensuse/tumbleweed:latest volumes: # bind mount the GitHub CLI tool from the Ubuntu host, - # it is a statically linked binary so it should work everywhere + # it is a statically linked binary so it should work also in TumbleWeed - /usr/bin/gh:/usr/bin/gh steps: @@ -32,7 +32,7 @@ jobs: run: | # disable unused repositories to have a faster refresh zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \ - zypper --non-interactive --gpg-auto-import-keys ref + zypper --non-interactive ref - name: Install tools run: zypper --non-interactive install --no-recommends git gettext-tools