From 8d7cd38aa536a8748caa8e4a9ddb7f0b7832a2be Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 18 Dec 2023 22:36:49 +0200 Subject: [PATCH] Only update ~/.docker/config.json if it exists Follow up to https://github.com/graalvm/mandrel/pull/641 Closes https://github.com/graalvm/mandrel/issues/642 --- .github/workflows/base-windows.yml | 12 ++++++++---- .github/workflows/base.yml | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/base-windows.yml b/.github/workflows/base-windows.yml index 07715bab36f7..07e5a6030b98 100644 --- a/.github/workflows/base-windows.yml +++ b/.github/workflows/base-windows.yml @@ -468,8 +468,10 @@ jobs: if: startsWith(matrix.os-name, 'windows') shell: bash run: | - cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new - mv ~/.docker/config.json.new ~/.docker/config.json + if [ -f ~/.docker/config.json ]; then + cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new + mv ~/.docker/config.json.new ~/.docker/config.json + fi - name: Change quarkus.version for Quarkus 2.2 to make mandrel-integration-test not apply quarkus_main.patch if: startsWith(matrix.os-name, 'windows') # See https://github.com/Karm/mandrel-integration-tests/pull/64 @@ -611,8 +613,10 @@ jobs: - name: Update Docker Client User Agent shell: bash run: | - cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new - mv ~/.docker/config.json.new ~/.docker/config.json + if [ -f ~/.docker/config.json ]; then + cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new + mv ~/.docker/config.json.new ~/.docker/config.json + fi - name: Build with Maven run: | cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt" diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 5e54959b80a0..10c39da39318 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -542,8 +542,10 @@ jobs: if: "!startsWith(matrix.os-name, 'windows')" shell: bash run: | - cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new - mv ~/.docker/config.json.new ~/.docker/config.json + if [ -f ~/.docker/config.json ]; then + cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new + mv ~/.docker/config.json.new ~/.docker/config.json + fi - name: Change quarkus.version for Quarkus 2.2 to make mandrel-integration-test not apply quarkus_main.patch if: "!startsWith(matrix.os-name, 'windows')" # See https://github.com/Karm/mandrel-integration-tests/pull/64 @@ -697,8 +699,10 @@ jobs: tar -xzvf jdk.tgz -C ${GRAALVM_HOME} --strip-components=1 - name: Update Docker Client User Agent run: | - cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new - mv ~/.docker/config.json.new ~/.docker/config.json + if [ -f ~/.docker/config.json ]; then + cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new + mv ~/.docker/config.json.new ~/.docker/config.json + fi - name: Install gdb run: | sudo apt-get update -y