From 8c81f489921603eefba5603a7b29f696356a2df0 Mon Sep 17 00:00:00 2001 From: EduardGomezEscandell Date: Wed, 20 Sep 2023 13:48:57 +0200 Subject: [PATCH] Point WSL-Pro-Service to current branch --- .../update-workspace-dependencies/action.yaml | 18 +++++++++++++++--- .../update-workspace-dependencies.sh | 6 +++--- .github/workflows/qa-azure.yaml | 5 +++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/actions/update-workspace-dependencies/action.yaml b/.github/actions/update-workspace-dependencies/action.yaml index 5f33fba5a..36e6de676 100644 --- a/.github/actions/update-workspace-dependencies/action.yaml +++ b/.github/actions/update-workspace-dependencies/action.yaml @@ -5,18 +5,30 @@ inputs: module: description: The go module to update the dependencies of required: true + target_ref: + description: Optionally change what git ref to point the dependencies to + required: false runs: using: "composite" steps: - name: Install dependencies shell: bash + if: runner.os == 'Linux' run: | - sudo DEBIAN_FRONTEND=noninteractive apt update - sudo DEBIAN_FRONTEND=noninteractive apt install -y jq + $SUDO sudo DEBIAN_FRONTEND=noninteractive apt update + $SUDO sudo DEBIAN_FRONTEND=noninteractive apt install -y jq + - name: Install dependencies + shell: bash + if: runner.os == 'Windows' + run: | + winget install jqlang.jq - name: Update workspace dependencies shell: bash run: | chmod +x ${{ github.action_path }}/update-workspace-dependencies.sh - ${{ github.action_path }}/update-workspace-dependencies.sh "${{ github.repository }}" "wsl-pro-service" + ${{ github.action_path }}/update-workspace-dependencies.sh \ + "${{ github.repository }}" \ + "wsl-pro-service" \ + ${{ inputs.target_ref }} diff --git a/.github/actions/update-workspace-dependencies/update-workspace-dependencies.sh b/.github/actions/update-workspace-dependencies/update-workspace-dependencies.sh index 527a05b51..bfa5d9f2c 100755 --- a/.github/actions/update-workspace-dependencies/update-workspace-dependencies.sh +++ b/.github/actions/update-workspace-dependencies/update-workspace-dependencies.sh @@ -3,6 +3,7 @@ set -eu github_repo="${1:-""}" target_module="${2:-""}" +target_ref="${3:-"`git rev-parse HEAD~0`"}" if [[ -z "${github_repo}" || -z "${target_module}" ]] ; then echo "Update the out-of-date workspace dependencies of the target modules" @@ -19,7 +20,6 @@ if [[ -z "${github_repo}" || -z "${target_module}" ]] ; then fi cd ${target_module} -current_commit=$(git rev-parse HEAD~0) # Find internal dependencies repo="github.com/${github_repo}" @@ -39,7 +39,7 @@ for dependency in ${dependencies}; do dep_commit=`echo $dependency | sed "s#${pattern}#\4#"` export GIT_TERMINAL_PROMPT="0" - diff_files="$(git diff --name-only ${dep_commit} -- "../${dep_path}")" + diff_files="$(git diff --name-only ${dep_commit} -- "../${dep_path}" 2>&1)" if [ -z "${diff_files}" ] ; then continue fi @@ -49,7 +49,7 @@ for dependency in ${dependencies}; do echo "Files changed since commit ${dep_commit}:" echo "${diff_files}" - go get "${repo}/${dep_path}@${current_commit}" + go get "${repo}/${dep_path}@${target_ref}" echo "::endgroup::" done diff --git a/.github/workflows/qa-azure.yaml b/.github/workflows/qa-azure.yaml index cce547554..728cb2b50 100644 --- a/.github/workflows/qa-azure.yaml +++ b/.github/workflows/qa-azure.yaml @@ -73,6 +73,11 @@ jobs: New-Item -ItemType Directory "ci-build/windows-agent" Get-AppxPackage -Name "CanonicalGroupLimited.UbuntuProForWindows" | Remove-AppxPackage .\tools\build\build-appx.ps1 -OutputDir "ci-build/windows-agent" -SkipInstall + - name: Point WSL-Pro-Service to current branch + uses: ./.github/actions/update-workspace-dependencies + with: + module: ubuntu-pro-for-windows + target_ref: ${{ github.ref_name }} - name: Build WSL-Pro-Service shell: powershell run: |