Skip to content

Commit

Permalink
Point WSL-Pro-Service to current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Sep 20, 2023
1 parent 63c11ba commit 8c81f48
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
18 changes: 15 additions & 3 deletions .github/actions/update-workspace-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"
Expand All @@ -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
Expand All @@ -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
5 changes: 5 additions & 0 deletions .github/workflows/qa-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 8c81f48

Please sign in to comment.