From 0aafe58a6402b79dcb05c680591f530f6d42cf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Sun, 26 May 2024 23:17:59 +0200 Subject: [PATCH] Make procuctId to URL translation work again (#50) --- .github/workflows/test.main.kts | 3 +- .github/workflows/test.yaml | 95 ++++++++++++++----- .../github/action/setup_wsl/Distribution.kt | 6 +- 3 files changed, 75 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test.main.kts b/.github/workflows/test.main.kts index fb6f368..43bcd96 100755 --- a/.github/workflows/test.main.kts +++ b/.github/workflows/test.main.kts @@ -108,8 +108,7 @@ val ubuntu1604 = mapOf( val distributions = listOf( debian, - // disable testing on Alpine for the time being due to https://github.com/Vampire/setup-wsl/issues/50 - //alpine, + alpine, kali, openSuseLeap15_2, ubuntu2204, diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 84f7c08..f9fe1e7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -336,6 +336,10 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' - wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' @@ -824,6 +828,10 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' - wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' @@ -920,6 +928,10 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' - wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' @@ -1049,6 +1061,10 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' - wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' @@ -1274,6 +1290,10 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' - wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' @@ -1479,26 +1499,31 @@ jobs: match-pattern: '*Debian*' default-absent-tool: 'dos2unix' distribution2: + wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' + distribution3: wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' default-absent-tool: 'dos2unix' - distribution3: + distribution4: wsl-id: 'openSUSE-Leap-15.2' user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' - distribution4: + distribution5: wsl-id: 'Ubuntu' user-id: 'Ubuntu-20.04' match-pattern: '*Ubuntu*20.04*' default-absent-tool: 'dos2unix' - distribution5: + distribution6: wsl-id: 'Ubuntu-18.04' user-id: 'Ubuntu-18.04' match-pattern: '*Ubuntu*18.04*' default-absent-tool: 'dos2unix' - distribution6: + distribution7: wsl-id: 'Ubuntu-16.04' user-id: 'Ubuntu-16.04' match-pattern: '*Ubuntu*16.04*' @@ -1509,26 +1534,31 @@ jobs: match-pattern: '*Debian*' default-absent-tool: 'dos2unix' distribution2: + wsl-id: 'Alpine' + user-id: 'Alpine' + match-pattern: '*Alpine*' + default-absent-tool: 'dos2unix' + distribution3: wsl-id: 'kali-linux' user-id: 'kali-linux' match-pattern: '*Kali*' default-absent-tool: 'dos2unix' - distribution3: + distribution4: wsl-id: 'openSUSE-Leap-15.2' user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' - distribution4: + distribution5: wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' default-absent-tool: 'dos2unix' - distribution5: + distribution6: wsl-id: 'Ubuntu-18.04' user-id: 'Ubuntu-18.04' match-pattern: '*Ubuntu*18.04*' default-absent-tool: 'dos2unix' - distribution6: + distribution7: wsl-id: 'Ubuntu-16.04' user-id: 'Ubuntu-16.04' match-pattern: '*Ubuntu*16.04*' @@ -1579,6 +1609,12 @@ jobs: distribution: '${{ matrix.distributions.distribution6.user-id }}' set-as-default: 'false' - id: 'step-7' + name: 'Execute action for ${{ matrix.distributions.distribution7.user-id }}' + uses: './' + with: + distribution: '${{ matrix.distributions.distribution7.user-id }}' + set-as-default: 'false' + - id: 'step-8' name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution' shell: 'wsl-bash_Debian {0}' run: |- @@ -1587,59 +1623,68 @@ jobs: if: |- always() && (steps.step-1.outcome == 'success') - - id: 'step-8' + - id: 'step-9' name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution' - shell: 'wsl-bash_kali-linux {0}' + shell: 'wsl-bash_Alpine {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution2.match-pattern }} ]] if: |- always() && (steps.step-2.outcome == 'success') - - id: 'step-9' + - id: 'step-10' name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution' - shell: 'wsl-bash_openSUSE-Leap-15.2 {0}' + shell: 'wsl-bash_kali-linux {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution3.match-pattern }} ]] if: |- always() && (steps.step-3.outcome == 'success') - - id: 'step-10' + - id: 'step-11' name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-22.04 {0}' + shell: 'wsl-bash_openSUSE-Leap-15.2 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]] if: |- always() && (steps.step-4.outcome == 'success') - && (matrix.distributions.distribution4.user-id != 'Ubuntu-20.04') - - id: 'step-11' - name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-20.04 {0}' + - id: 'step-12' + name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution' + shell: 'wsl-bash_Ubuntu-22.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) - [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]] + [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]] if: |- always() - && (steps.step-4.outcome == 'success') - && (matrix.distributions.distribution4.user-id != 'Ubuntu-22.04') - - id: 'step-12' + && (steps.step-5.outcome == 'success') + && (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04') + - id: 'step-13' name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-18.04 {0}' + shell: 'wsl-bash_Ubuntu-20.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]] if: |- always() && (steps.step-5.outcome == 'success') - - id: 'step-13' + && (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04') + - id: 'step-14' name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-16.04 {0}' + shell: 'wsl-bash_Ubuntu-18.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]] if: |- always() && (steps.step-6.outcome == 'success') + - id: 'step-15' + name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution' + shell: 'wsl-bash_Ubuntu-16.04 {0}' + run: |- + cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) + [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution7.match-pattern }} ]] + if: |- + always() + && (steps.step-7.outcome == 'success') diff --git a/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt b/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt index f2d3e70..e41f18a 100644 --- a/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt +++ b/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt @@ -63,7 +63,8 @@ sealed class Distribution( requestUrl = "https://store.rg-adguard.net/api/GetFiles", data = "type=ProductId&url=$productId", additionalHeaders = recordOf( - "Content-Type" to "application/x-www-form-urlencoded" + "Content-Type" to "application/x-www-form-urlencoded", + "User-Agent" to "Setup WSL GitHub Action" ) ).await() @@ -73,7 +74,8 @@ sealed class Distribution( requestUrl = "https://echo.free.beeceptor.com/api/GetFiles", data = "type=ProductId&url=$productId", additionalHeaders = recordOf( - "Content-Type" to "application/x-www-form-urlencoded" + "Content-Type" to "application/x-www-form-urlencoded", + "User-Agent" to "Setup WSL GitHub Action" ) ).await() if (echoResponse.message.statusCode == 200) {