From d1b3f7d10bb134ce8a9cbcf823bf24be7af7faad Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 24 Apr 2024 12:46:55 +0200 Subject: [PATCH] GH Actions: work around intermittent apt-get errors Okay, so apparently, there is a long-standing bug in the Microsoft package deploy process which caused `apt-get update` to fail in the first half hour after Microsoft has deployed a package. The failure looks like this: ``` E: Failed to fetch https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) ``` As this only happens intermittently (after a MS package deploy), the chance of running into this bug are slim, but guess what: today I ran into it. This change to the workflow is intended to prevent the next person running into this issue from having to waste time on figuring this out. By splitting the "Install xmllint" step into two steps: one doing the `apt-get update` and one doing the actual install and making the first step one which is allowed to `continue-on-error`, this issue should hopefully not crop up anymore. Any errors in the `apt-get update` step will now be ignored and as most errors which could potentially come from that step are irrelevant for the rest of the job anyway, this is fine. If a relevant error would be surfaced, the next step (the xmllint install), will fail the job anyway. Refs: * https://github.com/actions/runner-images/issues/3410 * https://github.com/dotnet/core/issues/4167 --- .github/workflows/cs.yml | 11 ++++++++--- .github/workflows/quicktest.yml | 11 ++++++++--- .github/workflows/test.yml | 11 ++++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 95b1dd4..d402f45 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -53,11 +53,16 @@ jobs: # Bust the cache at least once a month - output format: YYYY-MM. custom-cache-suffix: $(date -u "+%Y-%m") + # Updating the lists can fail intermittently, typically after Microsoft has released a new package. + # This should not be blocking for this job, so ignore any errors from this step. + # Ref: https://github.com/dotnet/core/issues/4167 + - name: Update the available packages list + continue-on-error: true + run: sudo apt-get update + # @link http://xmlsoft.org/xmllint.html - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends -y libxml2-utils + run: sudo apt-get install --no-install-recommends -y libxml2-utils - name: Download the XSD schema run: curl http://www.w3.org/2001/XMLSchema.xsd --output XMLSchema.xsd diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 1f76a94..c1e237f 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -38,10 +38,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + # Updating the lists can fail intermittently, typically after Microsoft has released a new package. + # This should not be blocking for this job, so ignore any errors from this step. + # Ref: https://github.com/dotnet/core/issues/4167 + - name: Update the available packages list + continue-on-error: true + run: sudo apt-get update + - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends -y libxml2-utils + run: sudo apt-get install --no-install-recommends -y libxml2-utils # On stable PHPCS versions, allow for PHP deprecation notices. # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b24582..83994e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -82,10 +82,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + # Updating the lists can fail intermittently, typically after Microsoft has released a new package. + # This should not be blocking for this job, so ignore any errors from this step. + # Ref: https://github.com/dotnet/core/issues/4167 + - name: Update the available packages list + continue-on-error: true + run: sudo apt-get update + - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends -y libxml2-utils + run: sudo apt-get install --no-install-recommends -y libxml2-utils - name: Setup ini config id: set_ini