forked from microsoft/hcsshim
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (127 loc) · 5.28 KB
/
pre.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# This workflow is used to download the Linux boot files from the Azure Artifact feed
<<<<<<< HEAD
# and upload them as artifacts so that they can be used in the proceeding workflow.
# The workflow runs under previledged mode to allow authentication with Azure.
=======
# and upload them as artifacts so that they can be used in the proceeding workflow for running Linux UVM tests.
# The workflow runs under previledged mode to allow authentication with Azure.
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
# Note that the workflow is run based on the workflow file of the base branch to protect against malicious workflow in the PR.
name: Pre-CI
on:
pull_request_target:
branches:
- jiechen3/github_runner
env:
LCOW_ARTIFACT_PROJECT: "ContainerPlatform"
LCOW_ARTIFACT_FEED: "ContainerPlat-Dev"
LCOW_ARTIFACT_NAME: "azurelinux-uvm"
LCOW_ARTIFACT_VERSION: "*.*.*"
jobs:
# This job downloads the Linux boot files from the Azure Artifact feed and
# create the rootfs containing the local Linux-GCS. It needs to be run on
# the 1ES github runner pool in order to access the Azure Artifact feed.
download-linux-boot-files:
runs-on:
<<<<<<< HEAD
ubuntu-latest
# - self-hosted
# - 1ES.Pool=containerplat-github-runner-pool-east-us-2
# - 1ES.ImageOverride=github-mms-ubuntu-22
=======
- self-hosted
- 1ES.Pool=containerplat-github-runner-pool-east-us-2
- 1ES.ImageOverride=github-mms-ubuntu-22
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
permissions:
id-token: write # This is required for OIDC login (azure/login) to succeed
contents: read # This is required for actions/checkout to succeed
steps:
- name: Check access
if: ${{
github.event.pull_request.author_association != 'COLLABORATOR' &&
github.event.pull_request.author_association != 'OWNER' &&
github.event.pull_request.author_association != 'CONTRIBUTOR'
}}
run: |
echo "Author association: ${{ github.event.pull_request.author_association }}"
<<<<<<< HEAD
echo "Event not triggered by a owner/collaborator/contributor. Will not continue CI."
=======
echo "Event not triggered by an owner/collaborator/contributor. Will not continue CI."
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
exit 1
# Install Azure CLI and login to Azure
- name: Azure OIDC Login
uses: azure/login@v2
with:
client-id: "930a0428-2b45-4cf9-9afe-b81bde516504"
tenant-id: "72f988bf-86f1-41af-91ab-2d7cd011db47"
allow-no-subscriptions: true
<<<<<<< HEAD
- name: Download Linux artifact from feed
=======
- name: Download LCOW artifact from feed
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az extension add --name azure-devops
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
az artifacts universal download \
--organization "https://msazure.visualstudio.com/" \
--project ${{ env.LCOW_ARTIFACT_PROJECT }} \
--scope project \
--feed ${{ env.LCOW_ARTIFACT_FEED }} \
--name ${{ env.LCOW_ARTIFACT_NAME }} \
--version ${{ env.LCOW_ARTIFACT_VERSION }} \
--path ./downloaded_artifacts
<<<<<<< HEAD
- name: Show downloaded lcow artifacts
run: find ./downloaded_artifacts -maxdepth 3 -ls
- name: Create directory for storing linux artifacts
run: |
mkdir -p ./linux_artifacts/
- name: Copy Linux kernel and rootfs tar files
run: |
mv ./downloaded_artifacts/LinuxBootFiles/kernel ./linux_artifacts/
mv ./downloaded_artifacts/LinuxBootFiles/vmlinux ./linux_artifacts/
mv ./downloaded_artifacts/rootfs-*.tar.gz ./linux_artifacts/
=======
- name: Show downloaded LCOW artifacts
run: find ./downloaded_artifacts -maxdepth 3 -ls
- name: Create directory for storing LCOW artifacts
run: |
mkdir -p ./lcow_artifacts/
- name: Copy Linux kernel and rootfs tar files
run: |
mv ./downloaded_artifacts/LinuxBootFiles/kernel ./lcow_artifacts/
mv ./downloaded_artifacts/LinuxBootFiles/vmlinux ./lcow_artifacts/
mv ./downloaded_artifacts/rootfs-*.tar.gz ./lcow_artifacts/
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
# This is a workaround to overcome the limitation of actions/upload-artifact@v4 used in later jobs.
# See https://github.com/actions/upload-artifact/tree/v4/?tab=readme-ov-file#permission-loss.
- name: Tar the files to preserve file permissions prior to upload
run: |
<<<<<<< HEAD
cd linux_artifacts
tar -cvf linux_artifacts.tar .
# Upload the Linux boot files so that they can be used in later jobs.
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux_artifact
path: linux_artifact.tar
=======
tar -cvf lcow_artifacts.tar -C ./lcow_artifacts .
# Upload the Linux boot files so that they can be used in later jobs.
- name: Upload LCOW artifact
uses: actions/upload-artifact@v4
with:
name: lcow_artifacts
path: lcow_artifacts.tar
>>>>>>> 81a8a9c4395aacccaec072163a05ffa7333bc360
if-no-files-found: error
overwrite: true
retention-days: 1