mirror of
https://github.com/actions/runner.git
synced 2025-12-11 12:57:05 +00:00
Remove runner trimmed packages. (#3074)
This commit is contained in:
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@@ -58,29 +58,6 @@ jobs:
|
|||||||
${{ matrix.devScript }} layout Release ${{ matrix.runtime }}
|
${{ matrix.devScript }} layout Release ${{ matrix.runtime }}
|
||||||
working-directory: src
|
working-directory: src
|
||||||
|
|
||||||
# Check runtime/externals hash
|
|
||||||
- name: Compute/Compare runtime and externals Hash
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Current dotnet runtime hash result: $DOTNET_RUNTIME_HASH"
|
|
||||||
echo "Current Externals hash result: $EXTERNALS_HASH"
|
|
||||||
|
|
||||||
NeedUpdate=0
|
|
||||||
if [ "$EXTERNALS_HASH" != "$(cat ./src/Misc/contentHash/externals/${{ matrix.runtime }})" ] ;then
|
|
||||||
echo Hash mismatch, Update ./src/Misc/contentHash/externals/${{ matrix.runtime }} to $EXTERNALS_HASH
|
|
||||||
NeedUpdate=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DOTNET_RUNTIME_HASH" != "$(cat ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }})" ] ;then
|
|
||||||
echo Hash mismatch, Update ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }} to $DOTNET_RUNTIME_HASH
|
|
||||||
NeedUpdate=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $NeedUpdate
|
|
||||||
env:
|
|
||||||
DOTNET_RUNTIME_HASH: ${{hashFiles('**/_layout_trims/runtime/**/*')}}
|
|
||||||
EXTERNALS_HASH: ${{hashFiles('**/_layout_trims/externals/**/*')}}
|
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
- name: L0
|
- name: L0
|
||||||
run: |
|
run: |
|
||||||
@@ -103,6 +80,3 @@ jobs:
|
|||||||
name: runner-package-${{ matrix.runtime }}
|
name: runner-package-${{ matrix.runtime }}
|
||||||
path: |
|
path: |
|
||||||
_package
|
_package
|
||||||
_package_trims/trim_externals
|
|
||||||
_package_trims/trim_runtime
|
|
||||||
_package_trims/trim_runtime_externals
|
|
||||||
|
|||||||
213
.github/workflows/dotnet-upgrade.yml
vendored
213
.github/workflows/dotnet-upgrade.yml
vendored
@@ -84,221 +84,20 @@ jobs:
|
|||||||
git commit -a -m "Upgrade dotnet sdk to v${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}"
|
git commit -a -m "Upgrade dotnet sdk to v${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}"
|
||||||
git push --set-upstream origin $branch_name
|
git push --set-upstream origin $branch_name
|
||||||
|
|
||||||
build-hashes:
|
create-pr:
|
||||||
if: ${{ needs.dotnet-update.outputs.SHOULD_UPDATE == 1 && needs.dotnet-update.outputs.BRANCH_EXISTS == 0 }}
|
|
||||||
needs: [dotnet-update]
|
needs: [dotnet-update]
|
||||||
outputs:
|
if: ${{ needs.dotnet-update.outputs.SHOULD_UPDATE == 1 && needs.dotnet-update.outputs.BRANCH_EXISTS == 0 }}
|
||||||
# pass outputs from this job to create-pr for use
|
runs-on: ubuntu-latest
|
||||||
DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}
|
|
||||||
NEEDS_HASH_UPDATE: ${{ steps.compute-hash.outputs.NEED_UPDATE }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, win-arm64, osx-x64, osx-arm64 ]
|
|
||||||
include:
|
|
||||||
- runtime: linux-x64
|
|
||||||
os: ubuntu-latest
|
|
||||||
devScript: ./dev.sh
|
|
||||||
|
|
||||||
- runtime: linux-arm64
|
|
||||||
os: ubuntu-latest
|
|
||||||
devScript: ./dev.sh
|
|
||||||
|
|
||||||
- runtime: linux-arm
|
|
||||||
os: ubuntu-latest
|
|
||||||
devScript: ./dev.sh
|
|
||||||
|
|
||||||
- runtime: osx-x64
|
|
||||||
os: macOS-latest
|
|
||||||
devScript: ./dev.sh
|
|
||||||
|
|
||||||
- runtime: osx-arm64
|
|
||||||
os: macOS-latest
|
|
||||||
devScript: ./dev.sh
|
|
||||||
|
|
||||||
- runtime: win-x64
|
|
||||||
os: windows-2019
|
|
||||||
devScript: ./dev
|
|
||||||
|
|
||||||
- runtime: win-arm64
|
|
||||||
os: windows-latest
|
|
||||||
devScript: ./dev
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: feature/dotnetsdk-upgrade/${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
ref: feature/dotnetsdk-upgrade/${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
||||||
|
|
||||||
# Build runner layout
|
|
||||||
- name: Build & Layout Release
|
|
||||||
run: |
|
|
||||||
${{ matrix.devScript }} layout Release ${{ matrix.runtime }}
|
|
||||||
working-directory: src
|
|
||||||
|
|
||||||
# Check runtime/externals hash
|
|
||||||
- name: Compute/Compare runtime and externals Hash
|
|
||||||
id: compute-hash
|
|
||||||
continue-on-error: true
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Current dotnet runtime hash result: $DOTNET_RUNTIME_HASH"
|
|
||||||
echo "Current Externals hash result: $EXTERNALS_HASH"
|
|
||||||
|
|
||||||
NeedUpdate=0
|
|
||||||
if [ "$EXTERNALS_HASH" != "$(cat ./src/Misc/contentHash/externals/${{ matrix.runtime }})" ] ;then
|
|
||||||
echo Hash mismatch, Update ./src/Misc/contentHash/externals/${{ matrix.runtime }} to $EXTERNALS_HASH
|
|
||||||
|
|
||||||
echo "EXTERNAL_HASH=$EXTERNALS_HASH" >> $GITHUB_OUTPUT
|
|
||||||
NeedUpdate=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DOTNET_RUNTIME_HASH" != "$(cat ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }})" ] ;then
|
|
||||||
echo Hash mismatch, Update ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }} to $DOTNET_RUNTIME_HASH
|
|
||||||
|
|
||||||
echo "DOTNET_RUNTIME_HASH=$DOTNET_RUNTIME_HASH" >> $GITHUB_OUTPUT
|
|
||||||
NeedUpdate=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "NEED_UPDATE=$NeedUpdate" >> $GITHUB_OUTPUT
|
|
||||||
env:
|
|
||||||
DOTNET_RUNTIME_HASH: ${{hashFiles('**/_layout_trims/runtime/**/*')}}
|
|
||||||
EXTERNALS_HASH: ${{hashFiles('**/_layout_trims/externals/**/*')}}
|
|
||||||
- name: update hash
|
|
||||||
if: ${{ steps.compute-hash.outputs.NEED_UPDATE == 1 }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
ExternalHash=${{ steps.compute-hash.outputs.EXTERNAL_HASH }}
|
|
||||||
DotNetRuntimeHash=${{ steps.compute-hash.outputs.DOTNET_RUNTIME_HASH }}
|
|
||||||
|
|
||||||
if [ -n "$ExternalHash" ]; then
|
|
||||||
echo "$ExternalHash" > ./src/Misc/contentHash/externals/${{ matrix.runtime }}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$DotNetRuntimeHash" ]; then
|
|
||||||
echo "$DotNetRuntimeHash" > ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }}
|
|
||||||
fi
|
|
||||||
- name: cache updated hashes
|
|
||||||
if: ${{ steps.compute-hash.outputs.NEED_UPDATE == 1 }}
|
|
||||||
uses: actions/cache/save@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/${{ matrix.runtime }}
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }}
|
|
||||||
key: compute-hashes-${{ matrix.runtime }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
|
|
||||||
|
|
||||||
hash-update:
|
|
||||||
needs: [build-hashes]
|
|
||||||
if: ${{ needs.build-hashes.outputs.NEEDS_HASH_UPDATE == 1 }}
|
|
||||||
outputs:
|
|
||||||
# pass outputs from this job to create-pr for use
|
|
||||||
DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.build-hashes.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: feature/dotnetsdk-upgrade/${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
- name: Restore cached hashes - linux-x64
|
|
||||||
id: cache-restore-linux-x64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/linux-x64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/linux-x64
|
|
||||||
key: compute-hashes-linux-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - linux-arm64
|
|
||||||
id: cache-restore-linux-arm64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/linux-arm64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/linux-arm64
|
|
||||||
key: compute-hashes-linux-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - linux-arm
|
|
||||||
id: cache-restore-linux-arm
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/linux-arm
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/linux-arm
|
|
||||||
key: compute-hashes-linux-arm-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - osx-x64
|
|
||||||
id: cache-restore-osx-x64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/osx-x64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/osx-x64
|
|
||||||
key: compute-hashes-osx-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - osx-arm64
|
|
||||||
id: cache-restore-osx-arm64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/osx-arm64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/osx-arm64
|
|
||||||
key: compute-hashes-osx-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - win-x64
|
|
||||||
id: cache-restore-win-x64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/win-x64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/win-x64
|
|
||||||
key: compute-hashes-win-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Restore cached hashes - win-arm64
|
|
||||||
id: cache-restore-win-arm64
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
path: |
|
|
||||||
./src/Misc/contentHash/externals/win-arm64
|
|
||||||
./src/Misc/contentHash/dotnetRuntime/win-arm64
|
|
||||||
key: compute-hashes-win-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
||||||
- name: Fetch cached computed hashes
|
|
||||||
if: steps.cache-restore-linux-x64.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-linux-arm64.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-linux-arm.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-win-x64.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-win-arm64.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-osx-x64.outputs.cache-hit == 'true' ||
|
|
||||||
steps.cache-restore-osx-arm64.outputs.cache-hit == 'true'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
Environments=( "linux-x64" "linux-arm64" "linux-arm" "win-x64" "win-arm64" "osx-x64" "osx-arm64" )
|
|
||||||
|
|
||||||
git config --global user.name "github-actions[bot]"
|
|
||||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git commit -a -m "Update computed hashes"
|
|
||||||
git push --set-upstream origin feature/dotnetsdk-upgrade/${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
|
|
||||||
create-pr:
|
|
||||||
needs: [hash-update]
|
|
||||||
outputs:
|
|
||||||
# pass outputs from this job to run-tests for use
|
|
||||||
DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.hash-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
gh pr create -B main -H feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} --title "Update dotnet sdk to latest version @${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" --body "
|
gh pr create -B main -H feature/dotnetsdk-upgrade/${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} --title "Update dotnet sdk to latest version @${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" --body "
|
||||||
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/${{ needs.hash-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}/latest.version
|
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/${{ needs.dotnet-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}/latest.version
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
404
.github/workflows/release.yml
vendored
404
.github/workflows/release.yml
vendored
@@ -53,27 +53,6 @@ jobs:
|
|||||||
win-arm64-sha: ${{ steps.sha.outputs.win-arm64-sha256 }}
|
win-arm64-sha: ${{ steps.sha.outputs.win-arm64-sha256 }}
|
||||||
osx-x64-sha: ${{ steps.sha.outputs.osx-x64-sha256 }}
|
osx-x64-sha: ${{ steps.sha.outputs.osx-x64-sha256 }}
|
||||||
osx-arm64-sha: ${{ steps.sha.outputs.osx-arm64-sha256 }}
|
osx-arm64-sha: ${{ steps.sha.outputs.osx-arm64-sha256 }}
|
||||||
linux-x64-sha-noexternals: ${{ steps.sha_noexternals.outputs.linux-x64-sha256 }}
|
|
||||||
linux-arm64-sha-noexternals: ${{ steps.sha_noexternals.outputs.linux-arm64-sha256 }}
|
|
||||||
linux-arm-sha-noexternals: ${{ steps.sha_noexternals.outputs.linux-arm-sha256 }}
|
|
||||||
win-x64-sha-noexternals: ${{ steps.sha_noexternals.outputs.win-x64-sha256 }}
|
|
||||||
win-arm64-sha-noexternals: ${{ steps.sha_noexternals.outputs.win-arm64-sha256 }}
|
|
||||||
osx-x64-sha-noexternals: ${{ steps.sha_noexternals.outputs.osx-x64-sha256 }}
|
|
||||||
osx-arm64-sha-noexternals: ${{ steps.sha_noexternals.outputs.osx-arm64-sha256 }}
|
|
||||||
linux-x64-sha-noruntime: ${{ steps.sha_noruntime.outputs.linux-x64-sha256 }}
|
|
||||||
linux-arm64-sha-noruntime: ${{ steps.sha_noruntime.outputs.linux-arm64-sha256 }}
|
|
||||||
linux-arm-sha-noruntime: ${{ steps.sha_noruntime.outputs.linux-arm-sha256 }}
|
|
||||||
win-x64-sha-noruntime: ${{ steps.sha_noruntime.outputs.win-x64-sha256 }}
|
|
||||||
win-arm64-sha-noruntime: ${{ steps.sha_noruntime.outputs.win-arm64-sha256 }}
|
|
||||||
osx-x64-sha-noruntime: ${{ steps.sha_noruntime.outputs.osx-x64-sha256 }}
|
|
||||||
osx-arm64-sha-noruntime: ${{ steps.sha_noruntime.outputs.osx-arm64-sha256 }}
|
|
||||||
linux-x64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.linux-x64-sha256 }}
|
|
||||||
linux-arm64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.linux-arm64-sha256 }}
|
|
||||||
linux-arm-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.linux-arm-sha256 }}
|
|
||||||
win-x64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.win-x64-sha256 }}
|
|
||||||
win-arm64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.win-arm64-sha256 }}
|
|
||||||
osx-x64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.osx-x64-sha256 }}
|
|
||||||
osx-arm64-sha-noruntime-noexternals: ${{ steps.sha_noruntime_noexternals.outputs.osx-arm64-sha256 }}
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, osx-x64, osx-arm64, win-arm64 ]
|
runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, osx-x64, osx-arm64, win-arm64 ]
|
||||||
@@ -136,76 +115,6 @@ jobs:
|
|||||||
id: sha
|
id: sha
|
||||||
name: Compute SHA256
|
name: Compute SHA256
|
||||||
working-directory: _package
|
working-directory: _package
|
||||||
- run: |
|
|
||||||
file=$(ls)
|
|
||||||
sha=$(sha256sum $file | awk '{ print $1 }')
|
|
||||||
echo "Computed sha256: $sha for $file"
|
|
||||||
echo "${{matrix.runtime}}-sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
id: sha_noexternals
|
|
||||||
name: Compute SHA256
|
|
||||||
working-directory: _package_trims/trim_externals
|
|
||||||
- run: |
|
|
||||||
file=$(ls)
|
|
||||||
sha=$(sha256sum $file | awk '{ print $1 }')
|
|
||||||
echo "Computed sha256: $sha for $file"
|
|
||||||
echo "${{matrix.runtime}}-sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
id: sha_noruntime
|
|
||||||
name: Compute SHA256
|
|
||||||
working-directory: _package_trims/trim_runtime
|
|
||||||
- run: |
|
|
||||||
file=$(ls)
|
|
||||||
sha=$(sha256sum $file | awk '{ print $1 }')
|
|
||||||
echo "Computed sha256: $sha for $file"
|
|
||||||
echo "${{matrix.runtime}}-sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha256=$sha" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
id: sha_noruntime_noexternals
|
|
||||||
name: Compute SHA256
|
|
||||||
working-directory: _package_trims/trim_runtime_externals
|
|
||||||
|
|
||||||
- name: Create trimmedpackages.json for ${{ matrix.runtime }}
|
|
||||||
if: matrix.runtime == 'win-x64' || matrix.runtime == 'win-arm64'
|
|
||||||
uses: actions/github-script@0.3.0
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
script: |
|
|
||||||
const core = require('@actions/core')
|
|
||||||
const fs = require('fs');
|
|
||||||
const runnerVersion = fs.readFileSync('src/runnerversion', 'utf8').replace(/\n$/g, '')
|
|
||||||
var trimmedPackages = fs.readFileSync('src/Misc/trimmedpackages_zip.json', 'utf8').replace(/<RUNNER_VERSION>/g, runnerVersion).replace(/<RUNNER_PLATFORM>/g, '${{ matrix.runtime }}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<RUNTIME_HASH>/g, '${{hashFiles('**/_layout_trims/runtime/**/*')}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<EXTERNALS_HASH>/g, '${{hashFiles('**/_layout_trims/externals/**/*')}}')
|
|
||||||
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_RUNTIME_EXTERNALS_HASH>/g, '${{steps.sha_noruntime_noexternals.outputs.sha256}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_RUNTIME_HASH>/g, '${{steps.sha_noruntime.outputs.sha256}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_EXTERNALS_HASH>/g, '${{steps.sha_noexternals.outputs.sha256}}')
|
|
||||||
|
|
||||||
console.log(trimmedPackages)
|
|
||||||
fs.writeFileSync('${{ matrix.runtime }}-trimmedpackages.json', trimmedPackages)
|
|
||||||
|
|
||||||
- name: Create trimmedpackages.json for ${{ matrix.runtime }}
|
|
||||||
if: matrix.runtime != 'win-x64' && matrix.runtime != 'win-arm64'
|
|
||||||
uses: actions/github-script@0.3.0
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
script: |
|
|
||||||
const core = require('@actions/core')
|
|
||||||
const fs = require('fs');
|
|
||||||
const runnerVersion = fs.readFileSync('src/runnerversion', 'utf8').replace(/\n$/g, '')
|
|
||||||
var trimmedPackages = fs.readFileSync('src/Misc/trimmedpackages_targz.json', 'utf8').replace(/<RUNNER_VERSION>/g, runnerVersion).replace(/<RUNNER_PLATFORM>/g, '${{ matrix.runtime }}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<RUNTIME_HASH>/g, '${{hashFiles('**/_layout_trims/runtime/**/*')}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<EXTERNALS_HASH>/g, '${{hashFiles('**/_layout_trims/externals/**/*')}}')
|
|
||||||
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_RUNTIME_EXTERNALS_HASH>/g, '${{steps.sha_noruntime_noexternals.outputs.sha256}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_RUNTIME_HASH>/g, '${{steps.sha_noruntime.outputs.sha256}}')
|
|
||||||
trimmedPackages = trimmedPackages.replace(/<NO_EXTERNALS_HASH>/g, '${{steps.sha_noexternals.outputs.sha256}}')
|
|
||||||
|
|
||||||
console.log(trimmedPackages)
|
|
||||||
fs.writeFileSync('${{ matrix.runtime }}-trimmedpackages.json', trimmedPackages)
|
|
||||||
|
|
||||||
# Upload runner package tar.gz/zip as artifact.
|
# Upload runner package tar.gz/zip as artifact.
|
||||||
# Since each package name is unique, so we don't need to put ${{matrix}} info into artifact name
|
# Since each package name is unique, so we don't need to put ${{matrix}} info into artifact name
|
||||||
@@ -216,10 +125,6 @@ jobs:
|
|||||||
name: runner-packages
|
name: runner-packages
|
||||||
path: |
|
path: |
|
||||||
_package
|
_package
|
||||||
_package_trims/trim_externals
|
|
||||||
_package_trims/trim_runtime
|
|
||||||
_package_trims/trim_runtime_externals
|
|
||||||
${{ matrix.runtime }}-trimmedpackages.json
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: build
|
||||||
@@ -253,27 +158,6 @@ jobs:
|
|||||||
releaseNote = releaseNote.replace(/<LINUX_X64_SHA>/g, '${{needs.build.outputs.linux-x64-sha}}')
|
releaseNote = releaseNote.replace(/<LINUX_X64_SHA>/g, '${{needs.build.outputs.linux-x64-sha}}')
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM_SHA>/g, '${{needs.build.outputs.linux-arm-sha}}')
|
releaseNote = releaseNote.replace(/<LINUX_ARM_SHA>/g, '${{needs.build.outputs.linux-arm-sha}}')
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM64_SHA>/g, '${{needs.build.outputs.linux-arm64-sha}}')
|
releaseNote = releaseNote.replace(/<LINUX_ARM64_SHA>/g, '${{needs.build.outputs.linux-arm64-sha}}')
|
||||||
releaseNote = releaseNote.replace(/<WIN_X64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.win-x64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<WIN_ARM64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.win-arm64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_X64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.osx-x64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_ARM64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.osx-arm64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_X64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.linux-x64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.linux-arm-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM64_SHA_NOEXTERNALS>/g, '${{needs.build.outputs.linux-arm64-sha-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<WIN_X64_SHA_NORUNTIME>/g, '${{needs.build.outputs.win-x64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<WIN_ARM64_SHA_NORUNTIME>/g, '${{needs.build.outputs.win-arm64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_X64_SHA_NORUNTIME>/g, '${{needs.build.outputs.osx-x64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_ARM64_SHA_NORUNTIME>/g, '${{needs.build.outputs.osx-arm64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_X64_SHA_NORUNTIME>/g, '${{needs.build.outputs.linux-x64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM_SHA_NORUNTIME>/g, '${{needs.build.outputs.linux-arm-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM64_SHA_NORUNTIME>/g, '${{needs.build.outputs.linux-arm64-sha-noruntime}}')
|
|
||||||
releaseNote = releaseNote.replace(/<WIN_X64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.win-x64-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<WIN_ARM64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.win-arm64-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_X64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.osx-x64-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<OSX_ARM64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.osx-arm64-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_X64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.linux-x64-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.linux-arm-sha-noruntime-noexternals}}')
|
|
||||||
releaseNote = releaseNote.replace(/<LINUX_ARM64_SHA_NORUNTIME_NOEXTERNALS>/g, '${{needs.build.outputs.linux-arm64-sha-noruntime-noexternals}}')
|
|
||||||
console.log(releaseNote)
|
console.log(releaseNote)
|
||||||
core.setOutput('version', runnerVersion);
|
core.setOutput('version', runnerVersion);
|
||||||
core.setOutput('note', releaseNote);
|
core.setOutput('note', releaseNote);
|
||||||
@@ -373,294 +257,6 @@ jobs:
|
|||||||
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}.tar.gz
|
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}.tar.gz
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
# Upload release assets (trim externals)
|
|
||||||
- name: Upload Release Asset (win-x64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noexternals.zip
|
|
||||||
asset_name: actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noexternals.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trim externals)
|
|
||||||
- name: Upload Release Asset (win-arm64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.zip
|
|
||||||
asset_name: actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-x64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-x64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-arm64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm64-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_externals/actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trim runtime)
|
|
||||||
- name: Upload Release Asset (win-x64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noruntime.zip
|
|
||||||
asset_name: actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noruntime.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trim runtime)
|
|
||||||
- name: Upload Release Asset (win-arm64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.zip
|
|
||||||
asset_name: actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-x64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_name: actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-x64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_name: actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-arm64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_name: actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm64-noruntime)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime/actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noruntime.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trim runtime and externals)
|
|
||||||
- name: Upload Release Asset (win-x64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.zip
|
|
||||||
asset_name: actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trim runtime and externals)
|
|
||||||
- name: Upload Release Asset (win-arm64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.zip
|
|
||||||
asset_name: actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.zip
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-x64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-x64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-arm64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm64-noruntime-noexternals)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/_package_trims/trim_runtime_externals/actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-noruntime-noexternals.tar.gz
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trimmedpackages.json)
|
|
||||||
- name: Upload Release Asset (win-x64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/win-x64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-win-x64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
# Upload release assets (trimmedpackages.json)
|
|
||||||
- name: Upload Release Asset (win-arm64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/win-arm64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-win-arm64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-x64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/linux-x64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-linux-x64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-x64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/osx-x64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-osx-x64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (osx-arm64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/osx-arm64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-osx-arm64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/linux-arm-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Upload Release Asset (linux-arm64-trimmedpackages.json)
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.createRelease.outputs.upload_url }}
|
|
||||||
asset_path: ${{ github.workspace }}/linux-arm64-trimmedpackages.json
|
|
||||||
asset_name: actions-runner-linux-arm64-${{ steps.releaseNote.outputs.version }}-trimmedpackages.json
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
publish-image:
|
publish-image:
|
||||||
needs: release
|
needs: release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -119,27 +119,3 @@ The SHA-256 checksums for the packages included in this build are shown below:
|
|||||||
- actions-runner-linux-x64-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-x64 --><LINUX_X64_SHA><!-- END SHA linux-x64 -->
|
- actions-runner-linux-x64-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-x64 --><LINUX_X64_SHA><!-- END SHA linux-x64 -->
|
||||||
- actions-runner-linux-arm64-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-arm64 --><LINUX_ARM64_SHA><!-- END SHA linux-arm64 -->
|
- actions-runner-linux-arm64-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-arm64 --><LINUX_ARM64_SHA><!-- END SHA linux-arm64 -->
|
||||||
- actions-runner-linux-arm-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-arm --><LINUX_ARM_SHA><!-- END SHA linux-arm -->
|
- actions-runner-linux-arm-<RUNNER_VERSION>.tar.gz <!-- BEGIN SHA linux-arm --><LINUX_ARM_SHA><!-- END SHA linux-arm -->
|
||||||
|
|
||||||
- actions-runner-win-x64-<RUNNER_VERSION>-noexternals.zip <!-- BEGIN SHA win-x64_noexternals --><WIN_X64_SHA_NOEXTERNALS><!-- END SHA win-x64_noexternals -->
|
|
||||||
- actions-runner-win-arm64-<RUNNER_VERSION>-noexternals.zip <!-- BEGIN SHA win-arm64_noexternals --><WIN_ARM64_SHA_NOEXTERNALS><!-- END SHA win-arm64_noexternals -->
|
|
||||||
- actions-runner-osx-x64-<RUNNER_VERSION>-noexternals.tar.gz <!-- BEGIN SHA osx-x64_noexternals --><OSX_X64_SHA_NOEXTERNALS><!-- END SHA osx-x64_noexternals -->
|
|
||||||
- actions-runner-osx-arm64-<RUNNER_VERSION>-noexternals.tar.gz <!-- BEGIN SHA osx-arm64_noexternals --><OSX_ARM64_SHA_NOEXTERNALS><!-- END SHA osx-arm64_noexternals -->
|
|
||||||
- actions-runner-linux-x64-<RUNNER_VERSION>-noexternals.tar.gz <!-- BEGIN SHA linux-x64_noexternals --><LINUX_X64_SHA_NOEXTERNALS><!-- END SHA linux-x64_noexternals -->
|
|
||||||
- actions-runner-linux-arm64-<RUNNER_VERSION>-noexternals.tar.gz <!-- BEGIN SHA linux-arm64_noexternals --><LINUX_ARM64_SHA_NOEXTERNALS><!-- END SHA linux-arm64_noexternals -->
|
|
||||||
- actions-runner-linux-arm-<RUNNER_VERSION>-noexternals.tar.gz <!-- BEGIN SHA linux-arm_noexternals --><LINUX_ARM_SHA_NOEXTERNALS><!-- END SHA linux-arm_noexternals -->
|
|
||||||
|
|
||||||
- actions-runner-win-x64-<RUNNER_VERSION>-noruntime.zip <!-- BEGIN SHA win-x64_noruntime --><WIN_X64_SHA_NORUNTIME><!-- END SHA win-x64_noruntime -->
|
|
||||||
- actions-runner-win-arm64-<RUNNER_VERSION>-noruntime.zip <!-- BEGIN SHA win-arm64_noruntime --><WIN_ARM64_SHA_NORUNTIME><!-- END SHA win-arm64_noruntime -->
|
|
||||||
- actions-runner-osx-x64-<RUNNER_VERSION>-noruntime.tar.gz <!-- BEGIN SHA osx-x64_noruntime --><OSX_X64_SHA_NORUNTIME><!-- END SHA osx-x64_noruntime -->
|
|
||||||
- actions-runner-osx-arm64-<RUNNER_VERSION>-noruntime.tar.gz <!-- BEGIN SHA osx-arm64_noruntime --><OSX_ARM64_SHA_NORUNTIME><!-- END SHA osx-arm64_noruntime -->
|
|
||||||
- actions-runner-linux-x64-<RUNNER_VERSION>-noruntime.tar.gz <!-- BEGIN SHA linux-x64_noruntime --><LINUX_X64_SHA_NORUNTIME><!-- END SHA linux-x64_noruntime -->
|
|
||||||
- actions-runner-linux-arm64-<RUNNER_VERSION>-noruntime.tar.gz <!-- BEGIN SHA linux-arm64_noruntime --><LINUX_ARM64_SHA_NORUNTIME><!-- END SHA linux-arm64_noruntime -->
|
|
||||||
- actions-runner-linux-arm-<RUNNER_VERSION>-noruntime.tar.gz <!-- BEGIN SHA linux-arm_noruntime --><LINUX_ARM_SHA_NORUNTIME><!-- END SHA linux-arm_noruntime -->
|
|
||||||
|
|
||||||
- actions-runner-win-x64-<RUNNER_VERSION>-noruntime-noexternals.zip <!-- BEGIN SHA win-x64_noruntime_noexternals --><WIN_X64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA win-x64_noruntime_noexternals -->
|
|
||||||
- actions-runner-win-arm64-<RUNNER_VERSION>-noruntime-noexternals.zip <!-- BEGIN SHA win-arm64_noruntime_noexternals --><WIN_ARM64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA win-arm64_noruntime_noexternals -->
|
|
||||||
- actions-runner-osx-x64-<RUNNER_VERSION>-noruntime-noexternals.tar.gz <!-- BEGIN SHA osx-x64_noruntime_noexternals --><OSX_X64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA osx-x64_noruntime_noexternals -->
|
|
||||||
- actions-runner-osx-arm64-<RUNNER_VERSION>-noruntime-noexternals.tar.gz <!-- BEGIN SHA osx-arm64_noruntime_noexternals --><OSX_ARM64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA osx-arm64_noruntime_noexternals -->
|
|
||||||
- actions-runner-linux-x64-<RUNNER_VERSION>-noruntime-noexternals.tar.gz <!-- BEGIN SHA linux-x64_noruntime_noexternals --><LINUX_X64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA linux-x64_noruntime_noexternals -->
|
|
||||||
- actions-runner-linux-arm64-<RUNNER_VERSION>-noruntime-noexternals.tar.gz <!-- BEGIN SHA linux-arm64_noruntime_noexternals --><LINUX_ARM64_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA linux-arm64_noruntime_noexternals -->
|
|
||||||
- actions-runner-linux-arm-<RUNNER_VERSION>-noruntime-noexternals.tar.gz <!-- BEGIN SHA linux-arm_noruntime_noexternals --><LINUX_ARM_SHA_NORUNTIME_NOEXTERNALS><!-- END SHA linux-arm_noruntime_noexternals -->
|
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
actions.runner.plist.template
|
|
||||||
actions.runner.service.template
|
|
||||||
checkScripts/downloadCert.js
|
|
||||||
checkScripts/makeWebRequest.js
|
|
||||||
darwin.svc.sh.template
|
|
||||||
hashFiles/index.js
|
|
||||||
installdependencies.sh
|
|
||||||
macos-run-invoker.js
|
|
||||||
Azure.Core.dll
|
|
||||||
Azure.Storage.Blobs.dll
|
|
||||||
Azure.Storage.Common.dll
|
|
||||||
Microsoft.Bcl.AsyncInterfaces.dll
|
|
||||||
Microsoft.IdentityModel.Logging.dll
|
|
||||||
Microsoft.IdentityModel.Tokens.dll
|
|
||||||
Minimatch.dll
|
|
||||||
Newtonsoft.Json.Bson.dll
|
|
||||||
Newtonsoft.Json.dll
|
|
||||||
Runner.Common.deps.json
|
|
||||||
Runner.Common.dll
|
|
||||||
Runner.Common.pdb
|
|
||||||
Runner.Listener
|
|
||||||
Runner.Listener.deps.json
|
|
||||||
Runner.Listener.dll
|
|
||||||
Runner.Listener.exe
|
|
||||||
Runner.Listener.pdb
|
|
||||||
Runner.Listener.runtimeconfig.json
|
|
||||||
Runner.PluginHost
|
|
||||||
Runner.PluginHost.deps.json
|
|
||||||
Runner.PluginHost.dll
|
|
||||||
Runner.PluginHost.exe
|
|
||||||
Runner.PluginHost.pdb
|
|
||||||
Runner.PluginHost.runtimeconfig.json
|
|
||||||
Runner.Plugins.deps.json
|
|
||||||
Runner.Plugins.dll
|
|
||||||
Runner.Plugins.pdb
|
|
||||||
Runner.Sdk.deps.json
|
|
||||||
Runner.Sdk.dll
|
|
||||||
Runner.Sdk.pdb
|
|
||||||
Runner.Worker
|
|
||||||
Runner.Worker.deps.json
|
|
||||||
Runner.Worker.dll
|
|
||||||
Runner.Worker.exe
|
|
||||||
Runner.Worker.pdb
|
|
||||||
Runner.Worker.runtimeconfig.json
|
|
||||||
RunnerService.exe
|
|
||||||
RunnerService.exe.config
|
|
||||||
RunnerService.js
|
|
||||||
RunnerService.pdb
|
|
||||||
runsvc.sh
|
|
||||||
Sdk.deps.json
|
|
||||||
Sdk.dll
|
|
||||||
Sdk.pdb
|
|
||||||
System.Diagnostics.DiagnosticSource.dll
|
|
||||||
System.IdentityModel.Tokens.Jwt.dll
|
|
||||||
System.IO.Hashing.dll
|
|
||||||
System.Memory.Data.dll
|
|
||||||
System.Net.Http.Formatting.dll
|
|
||||||
System.Security.Cryptography.Pkcs.dll
|
|
||||||
System.Security.Cryptography.ProtectedData.dll
|
|
||||||
System.ServiceProcess.ServiceController.dll
|
|
||||||
systemd.svc.sh.template
|
|
||||||
update.cmd.template
|
|
||||||
update.sh.template
|
|
||||||
YamlDotNet.dll
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
api-ms-win-core-console-l1-1-0.dll
|
|
||||||
api-ms-win-core-console-l1-2-0.dll
|
|
||||||
api-ms-win-core-datetime-l1-1-0.dll
|
|
||||||
api-ms-win-core-debug-l1-1-0.dll
|
|
||||||
api-ms-win-core-errorhandling-l1-1-0.dll
|
|
||||||
api-ms-win-core-fibers-l1-1-0.dll
|
|
||||||
api-ms-win-core-file-l1-1-0.dll
|
|
||||||
api-ms-win-core-file-l1-2-0.dll
|
|
||||||
api-ms-win-core-file-l2-1-0.dll
|
|
||||||
api-ms-win-core-handle-l1-1-0.dll
|
|
||||||
api-ms-win-core-heap-l1-1-0.dll
|
|
||||||
api-ms-win-core-interlocked-l1-1-0.dll
|
|
||||||
api-ms-win-core-libraryloader-l1-1-0.dll
|
|
||||||
api-ms-win-core-localization-l1-2-0.dll
|
|
||||||
api-ms-win-core-memory-l1-1-0.dll
|
|
||||||
api-ms-win-core-namedpipe-l1-1-0.dll
|
|
||||||
api-ms-win-core-processenvironment-l1-1-0.dll
|
|
||||||
api-ms-win-core-processthreads-l1-1-0.dll
|
|
||||||
api-ms-win-core-processthreads-l1-1-1.dll
|
|
||||||
api-ms-win-core-profile-l1-1-0.dll
|
|
||||||
api-ms-win-core-rtlsupport-l1-1-0.dll
|
|
||||||
api-ms-win-core-string-l1-1-0.dll
|
|
||||||
api-ms-win-core-synch-l1-1-0.dll
|
|
||||||
api-ms-win-core-synch-l1-2-0.dll
|
|
||||||
api-ms-win-core-sysinfo-l1-1-0.dll
|
|
||||||
api-ms-win-core-timezone-l1-1-0.dll
|
|
||||||
api-ms-win-core-util-l1-1-0.dll
|
|
||||||
api-ms-win-crt-conio-l1-1-0.dll
|
|
||||||
api-ms-win-crt-convert-l1-1-0.dll
|
|
||||||
api-ms-win-crt-environment-l1-1-0.dll
|
|
||||||
api-ms-win-crt-filesystem-l1-1-0.dll
|
|
||||||
api-ms-win-crt-heap-l1-1-0.dll
|
|
||||||
api-ms-win-crt-locale-l1-1-0.dll
|
|
||||||
api-ms-win-crt-math-l1-1-0.dll
|
|
||||||
api-ms-win-crt-multibyte-l1-1-0.dll
|
|
||||||
api-ms-win-crt-private-l1-1-0.dll
|
|
||||||
api-ms-win-crt-process-l1-1-0.dll
|
|
||||||
api-ms-win-crt-runtime-l1-1-0.dll
|
|
||||||
api-ms-win-crt-stdio-l1-1-0.dll
|
|
||||||
api-ms-win-crt-string-l1-1-0.dll
|
|
||||||
api-ms-win-crt-time-l1-1-0.dll
|
|
||||||
api-ms-win-crt-utility-l1-1-0.dll
|
|
||||||
clrcompression.dll
|
|
||||||
clretwrc.dll
|
|
||||||
clrjit.dll
|
|
||||||
coreclr.dll
|
|
||||||
createdump
|
|
||||||
createdump.exe
|
|
||||||
dbgshim.dll
|
|
||||||
hostfxr.dll
|
|
||||||
hostpolicy.dll
|
|
||||||
libclrjit.dylib
|
|
||||||
libclrjit.so
|
|
||||||
libcoreclr.dylib
|
|
||||||
libcoreclr.so
|
|
||||||
libcoreclrtraceptprovider.so
|
|
||||||
libdbgshim.dylib
|
|
||||||
libdbgshim.so
|
|
||||||
libhostfxr.dylib
|
|
||||||
libhostfxr.so
|
|
||||||
libhostpolicy.dylib
|
|
||||||
libhostpolicy.so
|
|
||||||
libmscordaccore.dylib
|
|
||||||
libmscordaccore.so
|
|
||||||
libmscordbi.dylib
|
|
||||||
libmscordbi.so
|
|
||||||
Microsoft.CSharp.dll
|
|
||||||
Microsoft.DiaSymReader.Native.amd64.dll
|
|
||||||
Microsoft.DiaSymReader.Native.arm64.dll
|
|
||||||
Microsoft.VisualBasic.Core.dll
|
|
||||||
Microsoft.VisualBasic.dll
|
|
||||||
Microsoft.Win32.Primitives.dll
|
|
||||||
Microsoft.Win32.Registry.dll
|
|
||||||
mscordaccore.dll
|
|
||||||
mscordaccore_amd64_amd64_6.0.522.21309.dll
|
|
||||||
mscordaccore_arm64_arm64_6.0.522.21309.dll
|
|
||||||
mscordaccore_amd64_amd64_6.0.1322.58009.dll
|
|
||||||
mscordaccore_amd64_amd64_6.0.2023.32017.dll
|
|
||||||
mscordaccore_amd64_amd64_6.0.2223.42425.dll
|
|
||||||
mscordaccore_amd64_amd64_6.0.2323.48002.dll
|
|
||||||
mscordbi.dll
|
|
||||||
mscorlib.dll
|
|
||||||
mscorrc.debug.dll
|
|
||||||
mscorrc.dll
|
|
||||||
msquic.dll
|
|
||||||
netstandard.dll
|
|
||||||
SOS_README.md
|
|
||||||
System.AppContext.dll
|
|
||||||
System.Buffers.dll
|
|
||||||
System.Collections.Concurrent.dll
|
|
||||||
System.Collections.dll
|
|
||||||
System.Collections.Immutable.dll
|
|
||||||
System.Collections.NonGeneric.dll
|
|
||||||
System.Collections.Specialized.dll
|
|
||||||
System.ComponentModel.Annotations.dll
|
|
||||||
System.ComponentModel.DataAnnotations.dll
|
|
||||||
System.ComponentModel.dll
|
|
||||||
System.ComponentModel.EventBasedAsync.dll
|
|
||||||
System.ComponentModel.Primitives.dll
|
|
||||||
System.ComponentModel.TypeConverter.dll
|
|
||||||
System.Configuration.dll
|
|
||||||
System.Console.dll
|
|
||||||
System.Core.dll
|
|
||||||
System.Data.Common.dll
|
|
||||||
System.Data.DataSetExtensions.dll
|
|
||||||
System.Data.dll
|
|
||||||
System.Diagnostics.Contracts.dll
|
|
||||||
System.Diagnostics.Debug.dll
|
|
||||||
System.Diagnostics.FileVersionInfo.dll
|
|
||||||
System.Diagnostics.Process.dll
|
|
||||||
System.Diagnostics.StackTrace.dll
|
|
||||||
System.Diagnostics.TextWriterTraceListener.dll
|
|
||||||
System.Diagnostics.Tools.dll
|
|
||||||
System.Diagnostics.TraceSource.dll
|
|
||||||
System.Diagnostics.Tracing.dll
|
|
||||||
System.dll
|
|
||||||
System.Drawing.dll
|
|
||||||
System.Drawing.Primitives.dll
|
|
||||||
System.Dynamic.Runtime.dll
|
|
||||||
System.Formats.Asn1.dll
|
|
||||||
System.Globalization.Calendars.dll
|
|
||||||
System.Globalization.dll
|
|
||||||
System.Globalization.Extensions.dll
|
|
||||||
System.Globalization.Native.dylib
|
|
||||||
System.Globalization.Native.so
|
|
||||||
System.IO.Compression.Brotli.dll
|
|
||||||
System.IO.Compression.dll
|
|
||||||
System.IO.Compression.FileSystem.dll
|
|
||||||
System.IO.Compression.Native.a
|
|
||||||
System.IO.Compression.Native.dll
|
|
||||||
System.IO.Compression.Native.dylib
|
|
||||||
System.IO.Compression.Native.so
|
|
||||||
System.IO.Compression.ZipFile.dll
|
|
||||||
System.IO.dll
|
|
||||||
System.IO.FileSystem.AccessControl.dll
|
|
||||||
System.IO.FileSystem.dll
|
|
||||||
System.IO.FileSystem.DriveInfo.dll
|
|
||||||
System.IO.FileSystem.Primitives.dll
|
|
||||||
System.IO.FileSystem.Watcher.dll
|
|
||||||
System.IO.IsolatedStorage.dll
|
|
||||||
System.IO.MemoryMappedFiles.dll
|
|
||||||
System.IO.Pipes.AccessControl.dll
|
|
||||||
System.IO.Pipes.dll
|
|
||||||
System.IO.UnmanagedMemoryStream.dll
|
|
||||||
System.Linq.dll
|
|
||||||
System.Linq.Expressions.dll
|
|
||||||
System.Linq.Parallel.dll
|
|
||||||
System.Linq.Queryable.dll
|
|
||||||
System.Memory.dll
|
|
||||||
System.Native.a
|
|
||||||
System.Native.dylib
|
|
||||||
System.Native.so
|
|
||||||
System.Net.dll
|
|
||||||
System.Net.Http.dll
|
|
||||||
System.Net.Http.Json.dll
|
|
||||||
System.Net.Http.Native.a
|
|
||||||
System.Net.Http.Native.dylib
|
|
||||||
System.Net.Http.Native.so
|
|
||||||
System.Net.HttpListener.dll
|
|
||||||
System.Net.Mail.dll
|
|
||||||
System.Net.NameResolution.dll
|
|
||||||
System.Net.NetworkInformation.dll
|
|
||||||
System.Net.Ping.dll
|
|
||||||
System.Net.Primitives.dll
|
|
||||||
System.Net.Quic.dll
|
|
||||||
System.Net.Requests.dll
|
|
||||||
System.Net.Security.dll
|
|
||||||
System.Net.Security.Native.a
|
|
||||||
System.Net.Security.Native.dylib
|
|
||||||
System.Net.Security.Native.so
|
|
||||||
System.Net.ServicePoint.dll
|
|
||||||
System.Net.Sockets.dll
|
|
||||||
System.Net.WebClient.dll
|
|
||||||
System.Net.WebHeaderCollection.dll
|
|
||||||
System.Net.WebProxy.dll
|
|
||||||
System.Net.WebSockets.Client.dll
|
|
||||||
System.Net.WebSockets.dll
|
|
||||||
System.Numerics.dll
|
|
||||||
System.Numerics.Vectors.dll
|
|
||||||
System.ObjectModel.dll
|
|
||||||
System.Private.CoreLib.dll
|
|
||||||
System.Private.DataContractSerialization.dll
|
|
||||||
System.Private.Uri.dll
|
|
||||||
System.Private.Xml.dll
|
|
||||||
System.Private.Xml.Linq.dll
|
|
||||||
System.Reflection.DispatchProxy.dll
|
|
||||||
System.Reflection.dll
|
|
||||||
System.Reflection.Emit.dll
|
|
||||||
System.Reflection.Emit.ILGeneration.dll
|
|
||||||
System.Reflection.Emit.Lightweight.dll
|
|
||||||
System.Reflection.Extensions.dll
|
|
||||||
System.Reflection.Metadata.dll
|
|
||||||
System.Reflection.Primitives.dll
|
|
||||||
System.Reflection.TypeExtensions.dll
|
|
||||||
System.Resources.Reader.dll
|
|
||||||
System.Resources.ResourceManager.dll
|
|
||||||
System.Resources.Writer.dll
|
|
||||||
System.Runtime.CompilerServices.Unsafe.dll
|
|
||||||
System.Runtime.CompilerServices.VisualC.dll
|
|
||||||
System.Runtime.dll
|
|
||||||
System.Runtime.Extensions.dll
|
|
||||||
System.Runtime.Handles.dll
|
|
||||||
System.Runtime.InteropServices.dll
|
|
||||||
System.Runtime.InteropServices.RuntimeInformation.dll
|
|
||||||
System.Runtime.InteropServices.WindowsRuntime.dll
|
|
||||||
System.Runtime.Intrinsics.dll
|
|
||||||
System.Runtime.Loader.dll
|
|
||||||
System.Runtime.Numerics.dll
|
|
||||||
System.Runtime.Serialization.dll
|
|
||||||
System.Runtime.Serialization.Formatters.dll
|
|
||||||
System.Runtime.Serialization.Json.dll
|
|
||||||
System.Runtime.Serialization.Primitives.dll
|
|
||||||
System.Runtime.Serialization.Xml.dll
|
|
||||||
System.Runtime.WindowsRuntime.dll
|
|
||||||
System.Runtime.WindowsRuntime.UI.Xaml.dll
|
|
||||||
System.Security.AccessControl.dll
|
|
||||||
System.Security.Claims.dll
|
|
||||||
System.Security.Cryptography.Algorithms.dll
|
|
||||||
System.Security.Cryptography.Cng.dll
|
|
||||||
System.Security.Cryptography.Csp.dll
|
|
||||||
System.Security.Cryptography.Encoding.dll
|
|
||||||
System.Security.Cryptography.Native.Apple.a
|
|
||||||
System.Security.Cryptography.Native.Apple.dylib
|
|
||||||
System.Security.Cryptography.Native.OpenSsl.a
|
|
||||||
System.Security.Cryptography.Native.OpenSsl.dylib
|
|
||||||
System.Security.Cryptography.Native.OpenSsl.so
|
|
||||||
System.Security.Cryptography.OpenSsl.dll
|
|
||||||
System.Security.Cryptography.Primitives.dll
|
|
||||||
System.Security.Cryptography.X509Certificates.dll
|
|
||||||
System.Security.Cryptography.XCertificates.dll
|
|
||||||
System.Security.dll
|
|
||||||
System.Security.Principal.dll
|
|
||||||
System.Security.Principal.Windows.dll
|
|
||||||
System.Security.SecureString.dll
|
|
||||||
System.ServiceModel.Web.dll
|
|
||||||
System.ServiceProcess.dll
|
|
||||||
System.Text.Encoding.CodePages.dll
|
|
||||||
System.Text.Encoding.dll
|
|
||||||
System.Text.Encoding.Extensions.dll
|
|
||||||
System.Text.Encodings.Web.dll
|
|
||||||
System.Text.Json.dll
|
|
||||||
System.Text.RegularExpressions.dll
|
|
||||||
System.Threading.Channels.dll
|
|
||||||
System.Threading.dll
|
|
||||||
System.Threading.Overlapped.dll
|
|
||||||
System.Threading.Tasks.Dataflow.dll
|
|
||||||
System.Threading.Tasks.dll
|
|
||||||
System.Threading.Tasks.Extensions.dll
|
|
||||||
System.Threading.Tasks.Parallel.dll
|
|
||||||
System.Threading.Thread.dll
|
|
||||||
System.Threading.ThreadPool.dll
|
|
||||||
System.Threading.Timer.dll
|
|
||||||
System.Transactions.dll
|
|
||||||
System.Transactions.Local.dll
|
|
||||||
System.ValueTuple.dll
|
|
||||||
System.Web.dll
|
|
||||||
System.Web.HttpUtility.dll
|
|
||||||
System.Windows.dll
|
|
||||||
System.Xml.dll
|
|
||||||
System.Xml.Linq.dll
|
|
||||||
System.Xml.ReaderWriter.dll
|
|
||||||
System.Xml.Serialization.dll
|
|
||||||
System.Xml.XDocument.dll
|
|
||||||
System.Xml.XmlDocument.dll
|
|
||||||
System.Xml.XmlSerializer.dll
|
|
||||||
System.Xml.XPath.dll
|
|
||||||
System.Xml.XPath.XDocument.dll
|
|
||||||
ucrtbase.dll
|
|
||||||
WindowsBase.dll
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_RUNTIME_EXTERNALS_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noruntime-noexternals.tar.gz",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"dotnetRuntime": "<RUNTIME_HASH>",
|
|
||||||
"externals": "<EXTERNALS_HASH>"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_RUNTIME_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noruntime.tar.gz",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"dotnetRuntime": "<RUNTIME_HASH>"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_EXTERNALS_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noexternals.tar.gz",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"externals": "<EXTERNALS_HASH>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_RUNTIME_EXTERNALS_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noruntime-noexternals.zip",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"dotnetRuntime": "<RUNTIME_HASH>",
|
|
||||||
"externals": "<EXTERNALS_HASH>"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_RUNTIME_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noruntime.zip",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"dotnetRuntime": "<RUNTIME_HASH>"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"HashValue": "<NO_EXTERNALS_HASH>",
|
|
||||||
"DownloadUrl": "https://github.com/actions/runner/releases/download/v<RUNNER_VERSION>/actions-runner-<RUNNER_PLATFORM>-<RUNNER_VERSION>-noexternals.zip",
|
|
||||||
"TrimmedContents": {
|
|
||||||
"externals": "<EXTERNALS_HASH>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -25,12 +25,6 @@
|
|||||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.4.0" />
|
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="..\Misc\runnercoreassets">
|
|
||||||
<LogicalName>GitHub.Runner.Listener.runnercoreassets</LogicalName>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ using System.IO;
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GitHub.DistributedTask.WebApi;
|
using GitHub.DistributedTask.WebApi;
|
||||||
using GitHub.Runner.Common;
|
using GitHub.Runner.Common;
|
||||||
using GitHub.Runner.Common.Util;
|
|
||||||
using GitHub.Runner.Sdk;
|
using GitHub.Runner.Sdk;
|
||||||
using GitHub.Services.Common;
|
using GitHub.Services.Common;
|
||||||
using GitHub.Services.WebApi;
|
using GitHub.Services.WebApi;
|
||||||
@@ -30,9 +28,6 @@ namespace GitHub.Runner.Listener
|
|||||||
{
|
{
|
||||||
private static string _packageType = "agent";
|
private static string _packageType = "agent";
|
||||||
private static string _platform = BuildConstants.RunnerPackage.PackageName;
|
private static string _platform = BuildConstants.RunnerPackage.PackageName;
|
||||||
private static string _dotnetRuntime = "dotnetRuntime";
|
|
||||||
private static string _externals = "externals";
|
|
||||||
private readonly Dictionary<string, string> _contentHashes = new();
|
|
||||||
|
|
||||||
private PackageMetadata _targetPackage;
|
private PackageMetadata _targetPackage;
|
||||||
private ITerminal _terminal;
|
private ITerminal _terminal;
|
||||||
@@ -40,10 +35,6 @@ namespace GitHub.Runner.Listener
|
|||||||
private int _poolId;
|
private int _poolId;
|
||||||
private ulong _agentId;
|
private ulong _agentId;
|
||||||
private readonly ConcurrentQueue<string> _updateTrace = new();
|
private readonly ConcurrentQueue<string> _updateTrace = new();
|
||||||
private Task _cloneAndCalculateContentHashTask;
|
|
||||||
private string _dotnetRuntimeCloneDirectory;
|
|
||||||
private string _externalsCloneDirectory;
|
|
||||||
|
|
||||||
public bool Busy { get; private set; }
|
public bool Busy { get; private set; }
|
||||||
|
|
||||||
public override void Initialize(IHostContext hostContext)
|
public override void Initialize(IHostContext hostContext)
|
||||||
@@ -56,8 +47,6 @@ namespace GitHub.Runner.Listener
|
|||||||
var settings = configStore.GetSettings();
|
var settings = configStore.GetSettings();
|
||||||
_poolId = settings.PoolId;
|
_poolId = settings.PoolId;
|
||||||
_agentId = settings.AgentId;
|
_agentId = settings.AgentId;
|
||||||
_dotnetRuntimeCloneDirectory = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), "__dotnet_runtime__");
|
|
||||||
_externalsCloneDirectory = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), "__externals__");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> SelfUpdate(AgentRefreshMessage updateMessage, IJobDispatcher jobDispatcher, bool restartInteractiveRunner, CancellationToken token)
|
public async Task<bool> SelfUpdate(AgentRefreshMessage updateMessage, IJobDispatcher jobDispatcher, bool restartInteractiveRunner, CancellationToken token)
|
||||||
@@ -67,13 +56,6 @@ namespace GitHub.Runner.Listener
|
|||||||
{
|
{
|
||||||
var totalUpdateTime = Stopwatch.StartNew();
|
var totalUpdateTime = Stopwatch.StartNew();
|
||||||
|
|
||||||
// Copy dotnet runtime and externals of current runner to a temp folder
|
|
||||||
// So we can re-use them with trimmed runner package, if possible.
|
|
||||||
// This process is best effort, if we can't use trimmed runner package,
|
|
||||||
// we will just go with the full package.
|
|
||||||
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);
|
|
||||||
_cloneAndCalculateContentHashTask = CloneAndCalculateAssetsHash(_dotnetRuntimeCloneDirectory, _externalsCloneDirectory, linkedTokenSource.Token);
|
|
||||||
|
|
||||||
if (!await UpdateNeeded(updateMessage.TargetVersion, token))
|
if (!await UpdateNeeded(updateMessage.TargetVersion, token))
|
||||||
{
|
{
|
||||||
Trace.Info($"Can't find available update package.");
|
Trace.Info($"Can't find available update package.");
|
||||||
@@ -87,24 +69,6 @@ namespace GitHub.Runner.Listener
|
|||||||
await UpdateRunnerUpdateStateAsync("Runner update in progress, do not shutdown runner.");
|
await UpdateRunnerUpdateStateAsync("Runner update in progress, do not shutdown runner.");
|
||||||
await UpdateRunnerUpdateStateAsync($"Downloading {_targetPackage.Version} runner");
|
await UpdateRunnerUpdateStateAsync($"Downloading {_targetPackage.Version} runner");
|
||||||
|
|
||||||
if (_targetPackage.TrimmedPackages?.Count > 0)
|
|
||||||
{
|
|
||||||
// wait for cloning assets task to finish only if we have trimmed packages
|
|
||||||
await _cloneAndCalculateContentHashTask;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
linkedTokenSource.Cancel();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _cloneAndCalculateContentHashTask;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Info($"Ingore errors after cancelling cloning assets task: {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await DownloadLatestRunner(token, updateMessage.TargetVersion);
|
await DownloadLatestRunner(token, updateMessage.TargetVersion);
|
||||||
Trace.Info($"Download latest runner and unzip into runner root.");
|
Trace.Info($"Download latest runner and unzip into runner root.");
|
||||||
|
|
||||||
@@ -218,54 +182,8 @@ namespace GitHub.Runner.Listener
|
|||||||
string archiveFile = null;
|
string archiveFile = null;
|
||||||
var packageDownloadUrl = _targetPackage.DownloadUrl;
|
var packageDownloadUrl = _targetPackage.DownloadUrl;
|
||||||
var packageHashValue = _targetPackage.HashValue;
|
var packageHashValue = _targetPackage.HashValue;
|
||||||
var runtimeTrimmed = false;
|
|
||||||
var externalsTrimmed = false;
|
|
||||||
var fallbackToFullPackage = false;
|
|
||||||
|
|
||||||
// Only try trimmed package if sever sends them and we have calculated hash value of the current runtime/externals.
|
|
||||||
if (_contentHashes.Count == 2 &&
|
|
||||||
_contentHashes.ContainsKey(_dotnetRuntime) &&
|
|
||||||
_contentHashes.ContainsKey(_externals) &&
|
|
||||||
_targetPackage.TrimmedPackages?.Count > 0)
|
|
||||||
{
|
|
||||||
Trace.Info($"Current runner content hash: {StringUtil.ConvertToJson(_contentHashes)}");
|
|
||||||
Trace.Info($"Trimmed packages info from service: {StringUtil.ConvertToJson(_targetPackage.TrimmedPackages)}");
|
|
||||||
// Try to see whether we can use any size trimmed down package to speed up runner updates.
|
|
||||||
foreach (var trimmedPackage in _targetPackage.TrimmedPackages)
|
|
||||||
{
|
|
||||||
if (trimmedPackage.TrimmedContents.Count == 2 &&
|
|
||||||
trimmedPackage.TrimmedContents.TryGetValue(_dotnetRuntime, out var trimmedRuntimeHash) &&
|
|
||||||
trimmedRuntimeHash == _contentHashes[_dotnetRuntime] &&
|
|
||||||
trimmedPackage.TrimmedContents.TryGetValue(_externals, out var trimmedExternalsHash) &&
|
|
||||||
trimmedExternalsHash == _contentHashes[_externals])
|
|
||||||
{
|
|
||||||
Trace.Info($"Use trimmed (runtime+externals) package '{trimmedPackage.DownloadUrl}' to update runner.");
|
|
||||||
packageDownloadUrl = trimmedPackage.DownloadUrl;
|
|
||||||
packageHashValue = trimmedPackage.HashValue;
|
|
||||||
runtimeTrimmed = true;
|
|
||||||
externalsTrimmed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (trimmedPackage.TrimmedContents.Count == 1 &&
|
|
||||||
trimmedPackage.TrimmedContents.TryGetValue(_externals, out trimmedExternalsHash) &&
|
|
||||||
trimmedExternalsHash == _contentHashes[_externals])
|
|
||||||
{
|
|
||||||
Trace.Info($"Use trimmed (externals) package '{trimmedPackage.DownloadUrl}' to update runner.");
|
|
||||||
packageDownloadUrl = trimmedPackage.DownloadUrl;
|
|
||||||
packageHashValue = trimmedPackage.HashValue;
|
|
||||||
externalsTrimmed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Trace.Info($"Can't use trimmed package from '{trimmedPackage.DownloadUrl}' since the current runner does not carry those trimmed content (Hash mismatch).");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateTrace.Enqueue($"DownloadUrl: {packageDownloadUrl}");
|
_updateTrace.Enqueue($"DownloadUrl: {packageDownloadUrl}");
|
||||||
_updateTrace.Enqueue($"RuntimeTrimmed: {runtimeTrimmed}");
|
|
||||||
_updateTrace.Enqueue($"ExternalsTrimmed: {externalsTrimmed}");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -323,12 +241,6 @@ namespace GitHub.Runner.Listener
|
|||||||
|
|
||||||
await ExtractRunnerPackage(archiveFile, latestRunnerDirectory, token);
|
await ExtractRunnerPackage(archiveFile, latestRunnerDirectory, token);
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (runtimeTrimmed || externalsTrimmed)
|
|
||||||
{
|
|
||||||
// if anything failed when we use trimmed package (download/validatehase/extract), try again with the full runner package.
|
|
||||||
Trace.Error($"Fail to download latest runner using trimmed package: {ex}");
|
|
||||||
fallbackToFullPackage = true;
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -347,74 +259,6 @@ namespace GitHub.Runner.Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var trimmedPackageRestoreTasks = new List<Task<bool>>();
|
|
||||||
if (!fallbackToFullPackage)
|
|
||||||
{
|
|
||||||
// Skip restoring externals and runtime if we are going to fullback to the full package.
|
|
||||||
if (externalsTrimmed)
|
|
||||||
{
|
|
||||||
trimmedPackageRestoreTasks.Add(RestoreTrimmedExternals(latestRunnerDirectory, token));
|
|
||||||
}
|
|
||||||
if (runtimeTrimmed)
|
|
||||||
{
|
|
||||||
trimmedPackageRestoreTasks.Add(RestoreTrimmedDotnetRuntime(latestRunnerDirectory, token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trimmedPackageRestoreTasks.Count > 0)
|
|
||||||
{
|
|
||||||
var restoreResults = await Task.WhenAll(trimmedPackageRestoreTasks);
|
|
||||||
if (restoreResults.Any(x => x == false))
|
|
||||||
{
|
|
||||||
// if any of the restore failed, fallback to full package.
|
|
||||||
fallbackToFullPackage = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fallbackToFullPackage)
|
|
||||||
{
|
|
||||||
Trace.Error("Something wrong with the trimmed runner package, failback to use the full package for runner updates.");
|
|
||||||
_updateTrace.Enqueue($"FallbackToFullPackage: {fallbackToFullPackage}");
|
|
||||||
|
|
||||||
IOUtil.DeleteDirectory(latestRunnerDirectory, token);
|
|
||||||
Directory.CreateDirectory(latestRunnerDirectory);
|
|
||||||
|
|
||||||
packageDownloadUrl = _targetPackage.DownloadUrl;
|
|
||||||
packageHashValue = _targetPackage.HashValue;
|
|
||||||
_updateTrace.Enqueue($"DownloadUrl: {packageDownloadUrl}");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
archiveFile = await DownLoadRunner(latestRunnerDirectory, packageDownloadUrl, packageHashValue, token);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(archiveFile))
|
|
||||||
{
|
|
||||||
throw new TaskCanceledException($"Runner package '{packageDownloadUrl}' failed after {Constants.RunnerDownloadRetryMaxAttempts} download attempts");
|
|
||||||
}
|
|
||||||
|
|
||||||
await ValidateRunnerHash(archiveFile, packageHashValue);
|
|
||||||
|
|
||||||
await ExtractRunnerPackage(archiveFile, latestRunnerDirectory, token);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// delete .zip file
|
|
||||||
if (!string.IsNullOrEmpty(archiveFile) && File.Exists(archiveFile))
|
|
||||||
{
|
|
||||||
Trace.Verbose("Deleting latest runner package zip: {0}", archiveFile);
|
|
||||||
IOUtil.DeleteFile(archiveFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
//it is not critical if we fail to delete the .zip file
|
|
||||||
Trace.Warning("Failed to delete runner package zip '{0}'. Exception: {1}", archiveFile, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await CopyLatestRunnerToRoot(latestRunnerDirectory, token);
|
await CopyLatestRunnerToRoot(latestRunnerDirectory, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,330 +639,5 @@ namespace GitHub.Runner.Listener
|
|||||||
Trace.Info($"Catch exception during report update state, ignore this error and continue auto-update.");
|
Trace.Info($"Catch exception during report update state, ignore this error and continue auto-update.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> RestoreTrimmedExternals(string downloadDirectory, CancellationToken token)
|
|
||||||
{
|
|
||||||
// Copy the current runner's externals if we are using a externals trimmed package
|
|
||||||
// Execute the node.js to make sure the copied externals is working.
|
|
||||||
var stopWatch = Stopwatch.StartNew();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Trace.Info($"Copy {_externalsCloneDirectory} to {Path.Combine(downloadDirectory, Constants.Path.ExternalsDirectory)}.");
|
|
||||||
IOUtil.CopyDirectory(_externalsCloneDirectory, Path.Combine(downloadDirectory, Constants.Path.ExternalsDirectory), token);
|
|
||||||
|
|
||||||
// try run node.js to see if current node.js works fine after copy over to new location.
|
|
||||||
var nodeVersions = NodeUtil.BuiltInNodeVersions;
|
|
||||||
foreach (var nodeVersion in nodeVersions)
|
|
||||||
{
|
|
||||||
var newNodeBinary = Path.Combine(downloadDirectory, Constants.Path.ExternalsDirectory, nodeVersion, "bin", $"node{IOUtil.ExeExtension}");
|
|
||||||
if (File.Exists(newNodeBinary))
|
|
||||||
{
|
|
||||||
using (var p = HostContext.CreateService<IProcessInvoker>())
|
|
||||||
{
|
|
||||||
var outputs = "";
|
|
||||||
p.ErrorDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data))
|
|
||||||
{
|
|
||||||
Trace.Error(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
p.OutputDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data))
|
|
||||||
{
|
|
||||||
Trace.Info(data.Data);
|
|
||||||
outputs = data.Data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var exitCode = await p.ExecuteAsync(HostContext.GetDirectory(WellKnownDirectory.Root), newNodeBinary, $"-e \"console.log('{nameof(RestoreTrimmedExternals)}')\"", null, token);
|
|
||||||
if (exitCode != 0)
|
|
||||||
{
|
|
||||||
Trace.Error($"{newNodeBinary} -e \"console.log()\" failed with exit code {exitCode}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.Equals(outputs, nameof(RestoreTrimmedExternals), StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
Trace.Error($"{newNodeBinary} -e \"console.log()\" did not output expected content.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to restore externals for trimmed package: {ex}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
stopWatch.Stop();
|
|
||||||
_updateTrace.Enqueue($"{nameof(RestoreTrimmedExternals)}Time: {stopWatch.ElapsedMilliseconds}ms");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<bool> RestoreTrimmedDotnetRuntime(string downloadDirectory, CancellationToken token)
|
|
||||||
{
|
|
||||||
// Copy the current runner's dotnet runtime if we are using a dotnet runtime trimmed package
|
|
||||||
// Execute the runner.listener to make sure the copied runtime is working.
|
|
||||||
var stopWatch = Stopwatch.StartNew();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Trace.Info($"Copy {_dotnetRuntimeCloneDirectory} to {Path.Combine(downloadDirectory, Constants.Path.BinDirectory)}.");
|
|
||||||
IOUtil.CopyDirectory(_dotnetRuntimeCloneDirectory, Path.Combine(downloadDirectory, Constants.Path.BinDirectory), token);
|
|
||||||
|
|
||||||
// try run the runner executable to see if current dotnet runtime + future runner binary works fine.
|
|
||||||
var newRunnerBinary = Path.Combine(downloadDirectory, Constants.Path.BinDirectory, "Runner.Listener");
|
|
||||||
using (var p = HostContext.CreateService<IProcessInvoker>())
|
|
||||||
{
|
|
||||||
p.ErrorDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data))
|
|
||||||
{
|
|
||||||
Trace.Error(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
p.OutputDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data))
|
|
||||||
{
|
|
||||||
Trace.Info(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var exitCode = await p.ExecuteAsync(HostContext.GetDirectory(WellKnownDirectory.Root), newRunnerBinary, "--version", null, token);
|
|
||||||
if (exitCode != 0)
|
|
||||||
{
|
|
||||||
Trace.Error($"{newRunnerBinary} --version failed with exit code {exitCode}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to restore dotnet runtime for trimmed package: {ex}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
stopWatch.Stop();
|
|
||||||
_updateTrace.Enqueue($"{nameof(RestoreTrimmedDotnetRuntime)}Time: {stopWatch.ElapsedMilliseconds}ms");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CloneAndCalculateAssetsHash(string dotnetRuntimeCloneDirectory, string externalsCloneDirectory, CancellationToken token)
|
|
||||||
{
|
|
||||||
var runtimeCloneTask = CloneDotnetRuntime(dotnetRuntimeCloneDirectory, token);
|
|
||||||
var externalsCloneTask = CloneExternals(externalsCloneDirectory, token);
|
|
||||||
|
|
||||||
var waitingTasks = new Dictionary<string, Task>()
|
|
||||||
{
|
|
||||||
{nameof(CloneDotnetRuntime), runtimeCloneTask},
|
|
||||||
{nameof(CloneExternals),externalsCloneTask}
|
|
||||||
};
|
|
||||||
|
|
||||||
while (waitingTasks.Count > 0)
|
|
||||||
{
|
|
||||||
Trace.Info($"Waiting for {waitingTasks.Count} tasks to complete.");
|
|
||||||
var complatedTask = await Task.WhenAny(waitingTasks.Values);
|
|
||||||
if (waitingTasks.ContainsKey(nameof(CloneExternals)) &&
|
|
||||||
complatedTask == waitingTasks[nameof(CloneExternals)])
|
|
||||||
{
|
|
||||||
Trace.Info($"Externals clone finished.");
|
|
||||||
waitingTasks.Remove(nameof(CloneExternals));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (await externalsCloneTask && !token.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
var externalsHash = await HashFiles(externalsCloneDirectory, token);
|
|
||||||
Trace.Info($"Externals content hash: {externalsHash}");
|
|
||||||
_contentHashes[_externals] = externalsHash;
|
|
||||||
_updateTrace.Enqueue($"ExternalsHash: {_contentHashes[_externals]}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Trace.Error($"Skip compute hash since clone externals failed/cancelled.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to hash externals content: {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (waitingTasks.ContainsKey(nameof(CloneDotnetRuntime)) &&
|
|
||||||
complatedTask == waitingTasks[nameof(CloneDotnetRuntime)])
|
|
||||||
{
|
|
||||||
Trace.Info($"Dotnet runtime clone finished.");
|
|
||||||
waitingTasks.Remove(nameof(CloneDotnetRuntime));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (await runtimeCloneTask && !token.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
var runtimeHash = await HashFiles(dotnetRuntimeCloneDirectory, token);
|
|
||||||
Trace.Info($"Runtime content hash: {runtimeHash}");
|
|
||||||
_contentHashes[_dotnetRuntime] = runtimeHash;
|
|
||||||
_updateTrace.Enqueue($"DotnetRuntimeHash: {_contentHashes[_dotnetRuntime]}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Trace.Error($"Skip compute hash since clone dotnet runtime failed/cancelled.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to hash runtime content: {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Trace.Info($"Still waiting for {waitingTasks.Count} tasks to complete.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<bool> CloneDotnetRuntime(string runtimeDir, CancellationToken token)
|
|
||||||
{
|
|
||||||
var stopWatch = Stopwatch.StartNew();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Trace.Info($"Cloning dotnet runtime to {runtimeDir}");
|
|
||||||
IOUtil.DeleteDirectory(runtimeDir, CancellationToken.None);
|
|
||||||
Directory.CreateDirectory(runtimeDir);
|
|
||||||
|
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
|
||||||
var assetsContent = default(string);
|
|
||||||
using (var stream = assembly.GetManifestResourceStream("GitHub.Runner.Listener.runnercoreassets"))
|
|
||||||
using (var streamReader = new StreamReader(stream))
|
|
||||||
{
|
|
||||||
assetsContent = await streamReader.ReadToEndAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(assetsContent))
|
|
||||||
{
|
|
||||||
var runnerCoreAssets = assetsContent.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
if (runnerCoreAssets.Length > 0)
|
|
||||||
{
|
|
||||||
var binDir = HostContext.GetDirectory(WellKnownDirectory.Bin);
|
|
||||||
IOUtil.CopyDirectory(binDir, runtimeDir, token);
|
|
||||||
|
|
||||||
var clonedFile = 0;
|
|
||||||
foreach (var file in Directory.EnumerateFiles(runtimeDir, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
token.ThrowIfCancellationRequested();
|
|
||||||
if (runnerCoreAssets.Any(x => file.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).EndsWith(x.Trim())))
|
|
||||||
{
|
|
||||||
Trace.Verbose($"{file} is part of the runner core, delete from cloned runtime directory.");
|
|
||||||
IOUtil.DeleteFile(file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clonedFile++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Trace.Info($"Successfully cloned dotnet runtime to {runtimeDir}. Total files: {clonedFile}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to clone dotnet runtime to {runtimeDir}");
|
|
||||||
Trace.Error(ex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
stopWatch.Stop();
|
|
||||||
_updateTrace.Enqueue($"{nameof(CloneDotnetRuntime)}Time: {stopWatch.ElapsedMilliseconds}ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task<bool> CloneExternals(string externalsDir, CancellationToken token)
|
|
||||||
{
|
|
||||||
var stopWatch = Stopwatch.StartNew();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Trace.Info($"Cloning externals to {externalsDir}");
|
|
||||||
IOUtil.DeleteDirectory(externalsDir, CancellationToken.None);
|
|
||||||
Directory.CreateDirectory(externalsDir);
|
|
||||||
IOUtil.CopyDirectory(HostContext.GetDirectory(WellKnownDirectory.Externals), externalsDir, token);
|
|
||||||
Trace.Info($"Successfully cloned externals to {externalsDir}.");
|
|
||||||
return Task.FromResult(true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"Fail to clone externals to {externalsDir}");
|
|
||||||
Trace.Error(ex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
stopWatch.Stop();
|
|
||||||
_updateTrace.Enqueue($"{nameof(CloneExternals)}Time: {stopWatch.ElapsedMilliseconds}ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.FromResult(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<string> HashFiles(string fileFolder, CancellationToken token)
|
|
||||||
{
|
|
||||||
Trace.Info($"Calculating hash for {fileFolder}");
|
|
||||||
|
|
||||||
var stopWatch = Stopwatch.StartNew();
|
|
||||||
string binDir = HostContext.GetDirectory(WellKnownDirectory.Bin);
|
|
||||||
string node = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), NodeUtil.GetInternalNodeVersion(), "bin", $"node{IOUtil.ExeExtension}");
|
|
||||||
string hashFilesScript = Path.Combine(binDir, "hashFiles");
|
|
||||||
var hashResult = string.Empty;
|
|
||||||
|
|
||||||
using (var processInvoker = HostContext.CreateService<IProcessInvoker>())
|
|
||||||
{
|
|
||||||
processInvoker.ErrorDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data) && data.Data.StartsWith("__OUTPUT__") && data.Data.EndsWith("__OUTPUT__"))
|
|
||||||
{
|
|
||||||
hashResult = data.Data.Substring(10, data.Data.Length - 20);
|
|
||||||
Trace.Info($"Hash result: '{hashResult}'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Trace.Info(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
processInvoker.OutputDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
Trace.Verbose(data.Data);
|
|
||||||
};
|
|
||||||
|
|
||||||
var env = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
["patterns"] = "**"
|
|
||||||
};
|
|
||||||
|
|
||||||
int exitCode = await processInvoker.ExecuteAsync(workingDirectory: fileFolder,
|
|
||||||
fileName: node,
|
|
||||||
arguments: $"\"{hashFilesScript.Replace("\"", "\\\"")}\"",
|
|
||||||
environment: env,
|
|
||||||
requireExitCodeZero: false,
|
|
||||||
outputEncoding: null,
|
|
||||||
killProcessOnCancel: true,
|
|
||||||
cancellationToken: token);
|
|
||||||
|
|
||||||
if (exitCode != 0)
|
|
||||||
{
|
|
||||||
Trace.Error($"hashFiles returns '{exitCode}' failed. Fail to hash files under directory '{fileFolder}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
stopWatch.Stop();
|
|
||||||
_updateTrace.Enqueue($"{nameof(HashFiles)}{Path.GetFileName(fileFolder)}Time: {stopWatch.ElapsedMilliseconds}ms");
|
|
||||||
return hashResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ namespace GitHub.Runner.Listener
|
|||||||
|
|
||||||
string archiveFile = null;
|
string archiveFile = null;
|
||||||
|
|
||||||
// Only try trimmed package if sever sends them and we have calculated hash value of the current runtime/externals.
|
|
||||||
_updateTrace.Enqueue($"DownloadUrl: {packageDownloadUrl}");
|
_updateTrace.Enqueue($"DownloadUrl: {packageDownloadUrl}");
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
private Mock<IConfigurationStore> _configStore;
|
private Mock<IConfigurationStore> _configStore;
|
||||||
private Mock<IJobDispatcher> _jobDispatcher;
|
private Mock<IJobDispatcher> _jobDispatcher;
|
||||||
private AgentRefreshMessage _refreshMessage = new(1, "2.999.0");
|
private AgentRefreshMessage _refreshMessage = new(1, "2.999.0");
|
||||||
private List<TrimmedPackageMetadata> _trimmedPackages = new();
|
|
||||||
|
|
||||||
#if !OS_WINDOWS
|
#if !OS_WINDOWS
|
||||||
private string _packageUrl = null;
|
private string _packageUrl = null;
|
||||||
@@ -71,12 +70,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var client = new HttpClient())
|
|
||||||
{
|
|
||||||
var json = await client.GetStringAsync($"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}-trimmedpackages.json");
|
|
||||||
_trimmedPackages = StringUtil.ConvertFromJson<List<TrimmedPackageMetadata>>(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl }));
|
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl }));
|
||||||
|
|
||||||
@@ -91,12 +84,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
var updater = new Runner.Listener.SelfUpdater();
|
||||||
@@ -152,12 +143,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
var updater = new Runner.Listener.SelfUpdater();
|
||||||
@@ -205,12 +194,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
var updater = new Runner.Listener.SelfUpdater();
|
||||||
@@ -260,12 +247,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
var updater = new Runner.Listener.SelfUpdater();
|
||||||
@@ -305,495 +290,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_CloneHash_RuntimeAndExternals()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new HttpClientHandlerFactory());
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper();
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper();
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper();
|
|
||||||
p3.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl, TrimmedPackages = new List<TrimmedPackageMetadata>() { new TrimmedPackageMetadata() } }));
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
Assert.True(result);
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0")));
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0")));
|
|
||||||
|
|
||||||
FieldInfo contentHashesProperty = updater.GetType().GetField("_contentHashes", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
|
||||||
Assert.NotNull(contentHashesProperty);
|
|
||||||
Dictionary<string, string> contentHashes = (Dictionary<string, string>)contentHashesProperty.GetValue(updater);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(contentHashes));
|
|
||||||
|
|
||||||
var dotnetRuntimeHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/dotnetRuntime/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var externalsHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
|
|
||||||
Assert.Equal(File.ReadAllText(dotnetRuntimeHashFile).Trim(), contentHashes["dotnetRuntime"]);
|
|
||||||
Assert.Equal(File.ReadAllText(externalsHashFile).Trim(), contentHashes["externals"]);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0"), CancellationToken.None);
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0"), CancellationToken.None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_Cancel_CloneHashTask_WhenNotNeeded()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new Mock<IHttpClientHandlerFactory>().Object);
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper();
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper();
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper();
|
|
||||||
p3.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
|
|
||||||
FieldInfo contentHashesProperty = updater.GetType().GetField("_contentHashes", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
|
||||||
Assert.NotNull(contentHashesProperty);
|
|
||||||
Dictionary<string, string> contentHashes = (Dictionary<string, string>)contentHashesProperty.GetValue(updater);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(contentHashes));
|
|
||||||
|
|
||||||
Assert.NotEqual(2, contentHashes.Count);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
hc.GetTrace().Error(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_UseExternalsTrimmedPackage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new HttpClientHandlerFactory());
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper(); // un-tar
|
|
||||||
p3.Initialize(hc);
|
|
||||||
var p4 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p4.Initialize(hc);
|
|
||||||
var p5 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p5.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p4);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p5);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
var trim = _trimmedPackages.Where(x => !x.TrimmedContents.ContainsKey("dotnetRuntime")).ToList();
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl, TrimmedPackages = trim }));
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
Assert.True(result);
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0")));
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0")));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0"), CancellationToken.None);
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0"), CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
var traceFile = Path.GetTempFileName();
|
|
||||||
File.Copy(hc.TraceFileName, traceFile, true);
|
|
||||||
|
|
||||||
var externalsHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var externalsHash = await File.ReadAllTextAsync(externalsHashFile);
|
|
||||||
|
|
||||||
if (externalsHash == trim[0].TrimmedContents["externals"])
|
|
||||||
{
|
|
||||||
Assert.Contains("Use trimmed (externals) package", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Contains("the current runner does not carry those trimmed content (Hash mismatch)", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_UseExternalsRuntimeTrimmedPackage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new HttpClientHandlerFactory());
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper(); // un-tar
|
|
||||||
p3.Initialize(hc);
|
|
||||||
var p4 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p4.Initialize(hc);
|
|
||||||
var p5 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p5.Initialize(hc);
|
|
||||||
var p6 = new ProcessInvokerWrapper(); // runner -v
|
|
||||||
p6.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p4);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p5);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p6);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
var trim = _trimmedPackages.Where(x => x.TrimmedContents.ContainsKey("dotnetRuntime") && x.TrimmedContents.ContainsKey("externals")).ToList();
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl, TrimmedPackages = trim }));
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
Assert.True(result);
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0")));
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0")));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0"), CancellationToken.None);
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0"), CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
var traceFile = Path.GetTempFileName();
|
|
||||||
File.Copy(hc.TraceFileName, traceFile, true);
|
|
||||||
|
|
||||||
var externalsHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var externalsHash = await File.ReadAllTextAsync(externalsHashFile);
|
|
||||||
|
|
||||||
var runtimeHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/dotnetRuntime/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var runtimeHash = await File.ReadAllTextAsync(runtimeHashFile);
|
|
||||||
|
|
||||||
if (externalsHash == trim[0].TrimmedContents["externals"] &&
|
|
||||||
runtimeHash == trim[0].TrimmedContents["dotnetRuntime"])
|
|
||||||
{
|
|
||||||
Assert.Contains("Use trimmed (runtime+externals) package", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Contains("the current runner does not carry those trimmed content (Hash mismatch)", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_NotUseExternalsRuntimeTrimmedPackageOnHashMismatch()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new HttpClientHandlerFactory());
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper(); // un-tar
|
|
||||||
p3.Initialize(hc);
|
|
||||||
var p4 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p4.Initialize(hc);
|
|
||||||
var p5 = new ProcessInvokerWrapper(); // node -v
|
|
||||||
p5.Initialize(hc);
|
|
||||||
var p6 = new ProcessInvokerWrapper(); // runner -v
|
|
||||||
p6.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p4);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p5);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p6);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
var trim = _trimmedPackages.ToList();
|
|
||||||
foreach (var package in trim)
|
|
||||||
{
|
|
||||||
foreach (var hash in package.TrimmedContents.Keys)
|
|
||||||
{
|
|
||||||
package.TrimmedContents[hash] = "mismatch";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl, TrimmedPackages = trim }));
|
|
||||||
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
Assert.True(result);
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0")));
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0")));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0"), CancellationToken.None);
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0"), CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
var traceFile = Path.GetTempFileName();
|
|
||||||
File.Copy(hc.TraceFileName, traceFile, true);
|
|
||||||
Assert.Contains("the current runner does not carry those trimmed content (Hash mismatch)", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Runner")]
|
|
||||||
public async void TestSelfUpdateAsync_FallbackToFullPackage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await FetchLatestRunner();
|
|
||||||
Assert.NotNull(_packageUrl);
|
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
|
||||||
using (var hc = new TestHostContext(this))
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(_packageUrl);
|
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
|
||||||
var updater = new Runner.Listener.SelfUpdater();
|
|
||||||
hc.SetSingleton<ITerminal>(_term.Object);
|
|
||||||
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
|
||||||
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
|
|
||||||
hc.SetSingleton<IHttpClientHandlerFactory>(new HttpClientHandlerFactory());
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p1.Initialize(hc);
|
|
||||||
var p2 = new ProcessInvokerWrapper(); // hashfiles
|
|
||||||
p2.Initialize(hc);
|
|
||||||
var p3 = new ProcessInvokerWrapper(); // un-tar trim
|
|
||||||
p3.Initialize(hc);
|
|
||||||
var p4 = new ProcessInvokerWrapper(); // un-tar full
|
|
||||||
p4.Initialize(hc);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p1);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p2);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p3);
|
|
||||||
hc.EnqueueInstance<IProcessInvoker>(p4);
|
|
||||||
updater.Initialize(hc);
|
|
||||||
|
|
||||||
var trim = _trimmedPackages.ToList();
|
|
||||||
foreach (var package in trim)
|
|
||||||
{
|
|
||||||
package.HashValue = "mismatch";
|
|
||||||
}
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.GetPackageAsync("agent", BuildConstants.RunnerPackage.PackageName, "2.999.0", true, It.IsAny<CancellationToken>()))
|
|
||||||
.Returns(Task.FromResult(new PackageMetadata() { Platform = BuildConstants.RunnerPackage.PackageName, Version = new PackageVersion("2.999.0"), DownloadUrl = _packageUrl, TrimmedPackages = trim }));
|
|
||||||
|
|
||||||
_runnerServer.Setup(x => x.UpdateAgentUpdateStateAsync(1, 1, It.IsAny<string>(), It.IsAny<string>()))
|
|
||||||
.Callback((int p, ulong a, string s, string t) =>
|
|
||||||
{
|
|
||||||
hc.GetTrace().Info(t);
|
|
||||||
})
|
|
||||||
.Returns(Task.FromResult(new TaskAgent()));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await updater.SelfUpdate(_refreshMessage, _jobDispatcher.Object, true, hc.RunnerShutdownToken);
|
|
||||||
Assert.True(result);
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0")));
|
|
||||||
Assert.True(Directory.Exists(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0")));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "bin.2.999.0"), CancellationToken.None);
|
|
||||||
IOUtil.DeleteDirectory(Path.Combine(hc.GetDirectory(WellKnownDirectory.Root), "externals.2.999.0"), CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
var traceFile = Path.GetTempFileName();
|
|
||||||
File.Copy(hc.TraceFileName, traceFile, true);
|
|
||||||
if (File.ReadAllText(traceFile).Contains("Use trimmed (runtime+externals) package"))
|
|
||||||
{
|
|
||||||
Assert.Contains("Something wrong with the trimmed runner package, failback to use the full package for runner updates", File.ReadAllText(traceFile));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hc.GetTrace().Warning("Skipping the 'TestSelfUpdateAsync_FallbackToFullPackage' test, as the `externals` or `runtime` hashes have been updated");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
private Mock<IConfigurationStore> _configStore;
|
private Mock<IConfigurationStore> _configStore;
|
||||||
private Mock<IJobDispatcher> _jobDispatcher;
|
private Mock<IJobDispatcher> _jobDispatcher;
|
||||||
private AgentRefreshMessage _refreshMessage = new(1, "2.999.0");
|
private AgentRefreshMessage _refreshMessage = new(1, "2.999.0");
|
||||||
private List<TrimmedPackageMetadata> _trimmedPackages = new();
|
|
||||||
|
|
||||||
#if !OS_WINDOWS
|
#if !OS_WINDOWS
|
||||||
private string _packageUrl = null;
|
private string _packageUrl = null;
|
||||||
@@ -81,12 +80,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdaterV2();
|
var updater = new Runner.Listener.SelfUpdaterV2();
|
||||||
@@ -143,12 +140,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdaterV2();
|
var updater = new Runner.Listener.SelfUpdaterV2();
|
||||||
@@ -194,12 +189,10 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
{
|
{
|
||||||
await FetchLatestRunner();
|
await FetchLatestRunner();
|
||||||
Assert.NotNull(_packageUrl);
|
Assert.NotNull(_packageUrl);
|
||||||
Assert.NotNull(_trimmedPackages);
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
Environment.SetEnvironmentVariable("RUNNER_L0_OVERRIDEBINDIR", Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", "_layout", "bin")));
|
||||||
using (var hc = new TestHostContext(this))
|
using (var hc = new TestHostContext(this))
|
||||||
{
|
{
|
||||||
hc.GetTrace().Info(_packageUrl);
|
hc.GetTrace().Info(_packageUrl);
|
||||||
hc.GetTrace().Info(StringUtil.ConvertToJson(_trimmedPackages));
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var updater = new Runner.Listener.SelfUpdaterV2();
|
var updater = new Runner.Listener.SelfUpdaterV2();
|
||||||
|
|||||||
@@ -1,301 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Channels;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using GitHub.Runner.Common.Util;
|
|
||||||
using GitHub.Runner.Sdk;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace GitHub.Runner.Common.Tests
|
|
||||||
{
|
|
||||||
public sealed class PackagesTrimL0
|
|
||||||
{
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_NewFilesCrossAll()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var runnerCoreAssetsFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnercoreassets");
|
|
||||||
var runnerDotnetRuntimeFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnerdotnetruntimeassets");
|
|
||||||
string layoutBin = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/bin");
|
|
||||||
var newFiles = new List<string>();
|
|
||||||
if (Directory.Exists(layoutBin))
|
|
||||||
{
|
|
||||||
var coreAssets = await File.ReadAllLinesAsync(runnerCoreAssetsFile);
|
|
||||||
var runtimeAssets = await File.ReadAllLinesAsync(runnerDotnetRuntimeFile);
|
|
||||||
foreach (var file in Directory.GetFiles(layoutBin, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
if (!coreAssets.Any(x => file.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).EndsWith(x)) &&
|
|
||||||
!runtimeAssets.Any(x => file.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).EndsWith(x)))
|
|
||||||
{
|
|
||||||
newFiles.Add(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newFiles.Count > 0)
|
|
||||||
{
|
|
||||||
Assert.True(false, $"Found new files '{string.Join('\n', newFiles)}'. These will break runner update using trimmed packages.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_OverlapFiles()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var runnerCoreAssetsFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnercoreassets");
|
|
||||||
var runnerDotnetRuntimeFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnerdotnetruntimeassets");
|
|
||||||
|
|
||||||
var coreAssets = await File.ReadAllLinesAsync(runnerCoreAssetsFile);
|
|
||||||
var runtimeAssets = await File.ReadAllLinesAsync(runnerDotnetRuntimeFile);
|
|
||||||
|
|
||||||
foreach (var line in coreAssets)
|
|
||||||
{
|
|
||||||
if (runtimeAssets.Contains(line, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
Assert.True(false, $"'Misc/runnercoreassets' and 'Misc/runnerdotnetruntimeassets' should not overlap.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_NewRunnerCoreAssets()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var runnerCoreAssetsFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnercoreassets");
|
|
||||||
var coreAssets = await File.ReadAllLinesAsync(runnerCoreAssetsFile);
|
|
||||||
|
|
||||||
string layoutBin = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/bin");
|
|
||||||
var newFiles = new List<string>();
|
|
||||||
if (Directory.Exists(layoutBin))
|
|
||||||
{
|
|
||||||
var binDirs = Directory.GetDirectories(TestUtil.GetSrcPath(), "net6.0", SearchOption.AllDirectories);
|
|
||||||
foreach (var binDir in binDirs)
|
|
||||||
{
|
|
||||||
if (binDir.Contains("Test") || binDir.Contains("obj"))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Directory.GetFiles(binDir, "*", SearchOption.TopDirectoryOnly).ToList().ForEach(x =>
|
|
||||||
{
|
|
||||||
if (!x.Contains("runtimeconfig.dev.json"))
|
|
||||||
{
|
|
||||||
if (!coreAssets.Any(y => x.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).EndsWith(y)))
|
|
||||||
{
|
|
||||||
newFiles.Add(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newFiles.Count > 0)
|
|
||||||
{
|
|
||||||
Assert.True(false, $"Found new files '{string.Join('\n', newFiles)}'. These will break runner update using trimmed packages. You might need to update `Misc/runnercoreassets`.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_NewDotnetRuntimeAssets()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var runnerDotnetRuntimeFile = Path.Combine(TestUtil.GetSrcPath(), @"Misc/runnerdotnetruntimeassets");
|
|
||||||
var runtimeAssets = await File.ReadAllLinesAsync(runnerDotnetRuntimeFile);
|
|
||||||
|
|
||||||
string layoutTrimsRuntimeAssets = Path.Combine(TestUtil.GetSrcPath(), @"../_layout_trims/runnerdotnetruntimeassets");
|
|
||||||
var newFiles = new List<string>();
|
|
||||||
if (File.Exists(layoutTrimsRuntimeAssets))
|
|
||||||
{
|
|
||||||
var runtimeAssetsCurrent = await File.ReadAllLinesAsync(layoutTrimsRuntimeAssets);
|
|
||||||
foreach (var runtimeFile in runtimeAssetsCurrent)
|
|
||||||
{
|
|
||||||
if (runtimeAssets.Any(x => runtimeFile.EndsWith(x, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newFiles.Add(runtimeFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newFiles.Count > 0)
|
|
||||||
{
|
|
||||||
Assert.True(false, $"Found new dotnet runtime files '{string.Join('\n', newFiles)}'. These will break runner update using trimmed packages. You might need to update `Misc/runnerdotnetruntimeassets`.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_CheckDotnetRuntimeHash()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var dotnetRuntimeHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/dotnetRuntime/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
trace.Info($"Current hash: {File.ReadAllText(dotnetRuntimeHashFile)}");
|
|
||||||
string layoutTrimsRuntimeAssets = Path.Combine(TestUtil.GetSrcPath(), @"../_layout_trims/runtime");
|
|
||||||
|
|
||||||
string binDir = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/bin");
|
|
||||||
|
|
||||||
#if OS_WINDOWS
|
|
||||||
string node = Path.Combine(TestUtil.GetSrcPath(), @"..\_layout\externals\node16\bin\node");
|
|
||||||
#else
|
|
||||||
string node = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/externals/node16/bin/node");
|
|
||||||
#endif
|
|
||||||
string hashFilesScript = Path.Combine(binDir, "hashFiles");
|
|
||||||
var hashResult = string.Empty;
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper();
|
|
||||||
p1.Initialize(hc);
|
|
||||||
|
|
||||||
p1.ErrorDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data) && data.Data.StartsWith("__OUTPUT__") && data.Data.EndsWith("__OUTPUT__"))
|
|
||||||
{
|
|
||||||
hashResult = data.Data.Substring(10, data.Data.Length - 20);
|
|
||||||
trace.Info($"Hash result: '{hashResult}'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trace.Info(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
p1.OutputDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
trace.Info(data.Data);
|
|
||||||
};
|
|
||||||
|
|
||||||
var env = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
["patterns"] = "**"
|
|
||||||
};
|
|
||||||
|
|
||||||
int exitCode = await p1.ExecuteAsync(workingDirectory: layoutTrimsRuntimeAssets,
|
|
||||||
fileName: node,
|
|
||||||
arguments: $"\"{hashFilesScript.Replace("\"", "\\\"")}\"",
|
|
||||||
environment: env,
|
|
||||||
requireExitCodeZero: true,
|
|
||||||
outputEncoding: null,
|
|
||||||
killProcessOnCancel: true,
|
|
||||||
cancellationToken: CancellationToken.None);
|
|
||||||
|
|
||||||
Assert.True(string.Equals(hashResult, File.ReadAllText(dotnetRuntimeHashFile).Trim()), $"Hash mismatch for dotnet runtime. You might need to update `Misc/contentHash/dotnetRuntime/{BuildConstants.RunnerPackage.PackageName}` or check if `hashFiles.ts` ever changed recently.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public async Task RunnerLayoutParts_CheckExternalsHash()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
var externalsHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
trace.Info($"Current hash: {File.ReadAllText(externalsHashFile)}");
|
|
||||||
|
|
||||||
string layoutTrimsExternalsAssets = Path.Combine(TestUtil.GetSrcPath(), @"../_layout_trims/externals");
|
|
||||||
|
|
||||||
string binDir = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/bin");
|
|
||||||
|
|
||||||
#if OS_WINDOWS
|
|
||||||
string node = Path.Combine(TestUtil.GetSrcPath(), @"..\_layout\externals\node16\bin\node");
|
|
||||||
#else
|
|
||||||
string node = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/externals/node16/bin/node");
|
|
||||||
#endif
|
|
||||||
string hashFilesScript = Path.Combine(binDir, "hashFiles");
|
|
||||||
var hashResult = string.Empty;
|
|
||||||
|
|
||||||
var p1 = new ProcessInvokerWrapper();
|
|
||||||
p1.Initialize(hc);
|
|
||||||
|
|
||||||
p1.ErrorDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(data.Data) && data.Data.StartsWith("__OUTPUT__") && data.Data.EndsWith("__OUTPUT__"))
|
|
||||||
{
|
|
||||||
hashResult = data.Data.Substring(10, data.Data.Length - 20);
|
|
||||||
trace.Info($"Hash result: '{hashResult}'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trace.Info(data.Data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
p1.OutputDataReceived += (_, data) =>
|
|
||||||
{
|
|
||||||
trace.Info(data.Data);
|
|
||||||
};
|
|
||||||
|
|
||||||
var env = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
["patterns"] = "**"
|
|
||||||
};
|
|
||||||
|
|
||||||
int exitCode = await p1.ExecuteAsync(workingDirectory: layoutTrimsExternalsAssets,
|
|
||||||
fileName: node,
|
|
||||||
arguments: $"\"{hashFilesScript.Replace("\"", "\\\"")}\"",
|
|
||||||
environment: env,
|
|
||||||
requireExitCodeZero: true,
|
|
||||||
outputEncoding: null,
|
|
||||||
killProcessOnCancel: true,
|
|
||||||
cancellationToken: CancellationToken.None);
|
|
||||||
|
|
||||||
Assert.True(string.Equals(hashResult, File.ReadAllText(externalsHashFile).Trim()), $"Hash mismatch for externals. You might need to update `Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}` or check if `hashFiles.ts` ever changed recently.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Common")]
|
|
||||||
public Task RunnerLayoutParts_ContentHashFilesNoNewline()
|
|
||||||
{
|
|
||||||
using (TestHostContext hc = new(this))
|
|
||||||
{
|
|
||||||
Tracing trace = hc.GetTrace();
|
|
||||||
|
|
||||||
var dotnetRuntimeHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/dotnetRuntime/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var dotnetRuntimeHash = File.ReadAllText(dotnetRuntimeHashFile);
|
|
||||||
trace.Info($"Current hash: {dotnetRuntimeHash}");
|
|
||||||
|
|
||||||
var externalsHashFile = Path.Combine(TestUtil.GetSrcPath(), $"Misc/contentHash/externals/{BuildConstants.RunnerPackage.PackageName}");
|
|
||||||
var externalsHash = File.ReadAllText(externalsHashFile);
|
|
||||||
trace.Info($"Current hash: {externalsHash}");
|
|
||||||
|
|
||||||
Assert.False(externalsHash.Any(x => char.IsWhiteSpace(x)), $"Found whitespace in externals hash file.");
|
|
||||||
Assert.False(dotnetRuntimeHash.Any(x => char.IsWhiteSpace(x)), $"Found whitespace in dotnet runtime hash file.");
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
109
src/dev.sh
109
src/dev.sh
@@ -14,13 +14,8 @@ DEV_TARGET_RUNTIME=$3
|
|||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
LAYOUT_DIR="$SCRIPT_DIR/../_layout"
|
LAYOUT_DIR="$SCRIPT_DIR/../_layout"
|
||||||
LAYOUT_TRIMS_DIR="$SCRIPT_DIR/../_layout_trims"
|
|
||||||
LAYOUT_TRIM_EXTERNALS_DIR="$LAYOUT_TRIMS_DIR/trim_externals"
|
|
||||||
LAYOUT_TRIM_RUNTIME_DIR="$LAYOUT_TRIMS_DIR/trim_runtime"
|
|
||||||
LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR="$LAYOUT_TRIMS_DIR/trim_runtime_externals"
|
|
||||||
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x"
|
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x"
|
||||||
PACKAGE_DIR="$SCRIPT_DIR/../_package"
|
PACKAGE_DIR="$SCRIPT_DIR/../_package"
|
||||||
PACKAGE_TRIMS_DIR="$SCRIPT_DIR/../_package_trims"
|
|
||||||
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
|
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
|
||||||
DOTNETSDK_VERSION="6.0.415"
|
DOTNETSDK_VERSION="6.0.415"
|
||||||
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
|
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
|
||||||
@@ -148,48 +143,6 @@ function layout ()
|
|||||||
|
|
||||||
heading "Setup externals folder for $RUNTIME_ID runner's layout"
|
heading "Setup externals folder for $RUNTIME_ID runner's layout"
|
||||||
bash ./Misc/externals.sh $RUNTIME_ID || checkRC externals.sh
|
bash ./Misc/externals.sh $RUNTIME_ID || checkRC externals.sh
|
||||||
|
|
||||||
heading "Create layout (Trimmed) ..."
|
|
||||||
|
|
||||||
rm -Rf "$LAYOUT_TRIMS_DIR"
|
|
||||||
mkdir -p "$LAYOUT_TRIMS_DIR"
|
|
||||||
mkdir -p "$LAYOUT_TRIMS_DIR/runtime"
|
|
||||||
cp -r "$LAYOUT_DIR/bin/." "$LAYOUT_TRIMS_DIR/runtime"
|
|
||||||
mkdir -p "$LAYOUT_TRIMS_DIR/externals"
|
|
||||||
cp -r "$LAYOUT_DIR/externals/." "$LAYOUT_TRIMS_DIR/externals"
|
|
||||||
|
|
||||||
pushd "$LAYOUT_TRIMS_DIR/runtime" > /dev/null
|
|
||||||
if [[ ("$CURRENT_PLATFORM" == "windows") ]]; then
|
|
||||||
sed -i 's/\n$/\r\n/' "$SCRIPT_DIR/Misc/runnercoreassets"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat "$SCRIPT_DIR/Misc/runnercoreassets" | xargs rm -f
|
|
||||||
find . -empty -type d -delete
|
|
||||||
find . -type f > "$LAYOUT_TRIMS_DIR/runnerdotnetruntimeassets"
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
heading "Create layout with externals trimmed ..."
|
|
||||||
mkdir -p "$LAYOUT_TRIM_EXTERNALS_DIR"
|
|
||||||
cp -r "$LAYOUT_DIR/." "$LAYOUT_TRIM_EXTERNALS_DIR/"
|
|
||||||
rm -Rf "$LAYOUT_TRIM_EXTERNALS_DIR/externals"
|
|
||||||
echo "Created... $LAYOUT_TRIM_EXTERNALS_DIR"
|
|
||||||
|
|
||||||
heading "Create layout with dotnet runtime trimmed ..."
|
|
||||||
mkdir -p "$LAYOUT_TRIM_RUNTIME_DIR"
|
|
||||||
cp -r "$LAYOUT_DIR/." "$LAYOUT_TRIM_RUNTIME_DIR/"
|
|
||||||
pushd "$LAYOUT_TRIM_RUNTIME_DIR/bin" > /dev/null
|
|
||||||
cat "$LAYOUT_TRIMS_DIR/runnerdotnetruntimeassets" | xargs rm -f
|
|
||||||
echo "Created... $LAYOUT_TRIM_RUNTIME_DIR"
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
heading "Create layout with externals and dotnet runtime trimmed ..."
|
|
||||||
mkdir -p "$LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR"
|
|
||||||
cp -r "$LAYOUT_DIR/." "$LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR/"
|
|
||||||
rm -Rf "$LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR/externals"
|
|
||||||
pushd "$LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR/bin" > /dev/null
|
|
||||||
cat "$LAYOUT_TRIMS_DIR/runnerdotnetruntimeassets" | xargs rm -f
|
|
||||||
echo "Created... $LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR"
|
|
||||||
popd > /dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function runtest ()
|
function runtest ()
|
||||||
@@ -226,9 +179,7 @@ function package ()
|
|||||||
find "${LAYOUT_DIR}/bin" -type f -name '*.pdb' -delete
|
find "${LAYOUT_DIR}/bin" -type f -name '*.pdb' -delete
|
||||||
|
|
||||||
mkdir -p "$PACKAGE_DIR"
|
mkdir -p "$PACKAGE_DIR"
|
||||||
mkdir -p "$PACKAGE_TRIMS_DIR"
|
|
||||||
rm -Rf "${PACKAGE_DIR:?}"/*
|
rm -Rf "${PACKAGE_DIR:?}"/*
|
||||||
rm -Rf "${PACKAGE_TRIMS_DIR:?}"/*
|
|
||||||
|
|
||||||
pushd "$PACKAGE_DIR" > /dev/null
|
pushd "$PACKAGE_DIR" > /dev/null
|
||||||
|
|
||||||
@@ -246,66 +197,6 @@ function package ()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
runner_trim_externals_pkg_name="actions-runner-${RUNTIME_ID}-${runner_ver}-noexternals"
|
|
||||||
heading "Packaging ${runner_trim_externals_pkg_name} (Trimmed)"
|
|
||||||
|
|
||||||
PACKAGE_TRIM_EXTERNALS_DIR="$PACKAGE_TRIMS_DIR/trim_externals"
|
|
||||||
mkdir -p "$PACKAGE_TRIM_EXTERNALS_DIR"
|
|
||||||
pushd "$PACKAGE_TRIM_EXTERNALS_DIR" > /dev/null
|
|
||||||
if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then
|
|
||||||
tar_name="${runner_trim_externals_pkg_name}.tar.gz"
|
|
||||||
echo "Creating $tar_name in ${LAYOUT_TRIM_EXTERNALS_DIR}"
|
|
||||||
tar -czf "${tar_name}" -C "${LAYOUT_TRIM_EXTERNALS_DIR}" .
|
|
||||||
elif [[ ("$CURRENT_PLATFORM" == "windows") ]]; then
|
|
||||||
zip_name="${runner_trim_externals_pkg_name}.zip"
|
|
||||||
echo "Convert ${LAYOUT_TRIM_EXTERNALS_DIR} to Windows style path"
|
|
||||||
window_path=${LAYOUT_TRIM_EXTERNALS_DIR:1}
|
|
||||||
window_path=${window_path:0:1}:${window_path:1}
|
|
||||||
echo "Creating $zip_name in ${window_path}"
|
|
||||||
$POWERSHELL -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Add-Type -Assembly \"System.IO.Compression.FileSystem\"; [System.IO.Compression.ZipFile]::CreateFromDirectory(\"${window_path}\", \"${zip_name}\")"
|
|
||||||
fi
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
runner_trim_runtime_pkg_name="actions-runner-${RUNTIME_ID}-${runner_ver}-noruntime"
|
|
||||||
heading "Packaging ${runner_trim_runtime_pkg_name} (Trimmed)"
|
|
||||||
|
|
||||||
PACKAGE_TRIM_RUNTIME_DIR="$PACKAGE_TRIMS_DIR/trim_runtime"
|
|
||||||
mkdir -p "$PACKAGE_TRIM_RUNTIME_DIR"
|
|
||||||
pushd "$PACKAGE_TRIM_RUNTIME_DIR" > /dev/null
|
|
||||||
if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then
|
|
||||||
tar_name="${runner_trim_runtime_pkg_name}.tar.gz"
|
|
||||||
echo "Creating $tar_name in ${LAYOUT_TRIM_RUNTIME_DIR}"
|
|
||||||
tar -czf "${tar_name}" -C "${LAYOUT_TRIM_RUNTIME_DIR}" .
|
|
||||||
elif [[ ("$CURRENT_PLATFORM" == "windows") ]]; then
|
|
||||||
zip_name="${runner_trim_runtime_pkg_name}.zip"
|
|
||||||
echo "Convert ${LAYOUT_TRIM_RUNTIME_DIR} to Windows style path"
|
|
||||||
window_path=${LAYOUT_TRIM_RUNTIME_DIR:1}
|
|
||||||
window_path=${window_path:0:1}:${window_path:1}
|
|
||||||
echo "Creating $zip_name in ${window_path}"
|
|
||||||
$POWERSHELL -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Add-Type -Assembly \"System.IO.Compression.FileSystem\"; [System.IO.Compression.ZipFile]::CreateFromDirectory(\"${window_path}\", \"${zip_name}\")"
|
|
||||||
fi
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
runner_trim_runtime_externals_pkg_name="actions-runner-${RUNTIME_ID}-${runner_ver}-noruntime-noexternals"
|
|
||||||
heading "Packaging ${runner_trim_runtime_externals_pkg_name} (Trimmed)"
|
|
||||||
|
|
||||||
PACKAGE_TRIM_RUNTIME_EXTERNALS_DIR="$PACKAGE_TRIMS_DIR/trim_runtime_externals"
|
|
||||||
mkdir -p "$PACKAGE_TRIM_RUNTIME_EXTERNALS_DIR"
|
|
||||||
pushd "$PACKAGE_TRIM_RUNTIME_EXTERNALS_DIR" > /dev/null
|
|
||||||
if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then
|
|
||||||
tar_name="${runner_trim_runtime_externals_pkg_name}.tar.gz"
|
|
||||||
echo "Creating $tar_name in ${LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR}"
|
|
||||||
tar -czf "${tar_name}" -C "${LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR}" .
|
|
||||||
elif [[ ("$CURRENT_PLATFORM" == "windows") ]]; then
|
|
||||||
zip_name="${runner_trim_runtime_externals_pkg_name}.zip"
|
|
||||||
echo "Convert ${LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR} to Windows style path"
|
|
||||||
window_path=${LAYOUT_TRIM_RUNTIME_EXTERNALS_DIR:1}
|
|
||||||
window_path=${window_path:0:1}:${window_path:1}
|
|
||||||
echo "Creating $zip_name in ${window_path}"
|
|
||||||
$POWERSHELL -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Add-Type -Assembly \"System.IO.Compression.FileSystem\"; [System.IO.Compression.ZipFile]::CreateFromDirectory(\"${window_path}\", \"${zip_name}\")"
|
|
||||||
fi
|
|
||||||
popd > /dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then
|
if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user