Skip to content

Commit e0623de

Browse files
committed
Only download files in pre-ci
1 parent a04e69e commit e0623de

File tree

1 file changed

+23
-43
lines changed

1 file changed

+23
-43
lines changed

.github/workflows/pre.yml

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
name: Create Linux Boot Files
1+
name: Pre-CI
22
on:
3-
- push
4-
- pull_request_target
3+
push:
4+
pull_request_target:
5+
# branches:
6+
# - main # The workflow would be run based on the workflow file of the base branch to protect against malicious workflow in the PR.
57

68
env:
79
LCOW_ARTIFACT_PROJECT: "ContainerPlatform"
@@ -14,7 +16,7 @@ jobs:
1416
# This job downloads the Linux boot files from the Azure Artifact feed and
1517
# create the rootfs containing the local Linux-GCS. It needs to be run on
1618
# the 1ES github runner pool in order to access the Azure Artifact feed.
17-
create-linux-boot-files:
19+
donwload-linux-boot-files:
1820
runs-on:
1921
- self-hosted
2022
- 1ES.Pool=containerplat-github-runner-pool-east-us-2
@@ -26,25 +28,26 @@ jobs:
2628
- name: Check access
2729
if: ${{ github.event.pull_request.author_association != 'COLLABORATOR' && github.event.pull_request.author_association != 'OWNER' }}
2830
run: |
29-
echo "Event not triggered by a collaborator. Will not continue CI."
3031
echo "Author association: ${{ github.event.pull_request.author_association }}"
32+
echo "Pull Request: ${{ github.event.pull_request }}"
33+
34+
echo "Event not triggered by a collaborator. Will not continue CI."
3135
exit 1
3236
33-
- name: Checkout hcsshim
34-
uses: actions/checkout@v4
35-
with:
36-
show-progress: false
37+
# - name: Checkout hcsshim
38+
# uses: actions/checkout@v4
39+
# with:
40+
# show-progress: false
3741

3842
# Install Azure CLI and login to Azure
3943
- name: Azure OIDC Login
4044
uses: azure/login@v2
4145
with:
42-
auth-type: IDENTITY
4346
client-id: "930a0428-2b45-4cf9-9afe-b81bde516504"
4447
tenant-id: "72f988bf-86f1-41af-91ab-2d7cd011db47"
4548
allow-no-subscriptions: true
4649

47-
- name: Download artifact from feed
50+
- name: Download Linux artifact from feed
4851
uses: azure/cli@v2
4952
with:
5053
azcliversion: latest
@@ -64,52 +67,29 @@ jobs:
6467
- name: Show downloaded lcow artifacts
6568
run: find ./downloaded_artifacts -maxdepth 3 -ls
6669

67-
- name: Create directory for storing linux boot files
70+
- name: Create directory for storing linux artifacts
6871
run: |
69-
mkdir -p ${{ env.LINUX_BOOT_FILES_PATH }}/
70-
mkdir -p ./temp_rootfs/
72+
mkdir -p ./linux_artifacts/
7173
7274
- name: Copy Linux kernel and rootfs tar files
7375
run: |
74-
mv ./downloaded_artifacts/LinuxBootFiles/kernel ${{ env.LINUX_BOOT_FILES_PATH }}/
75-
mv ./downloaded_artifacts/LinuxBootFiles/vmlinux ${{ env.LINUX_BOOT_FILES_PATH }}/
76-
mv ./downloaded_artifacts/rootfs-*.tar.gz ./temp_rootfs/
77-
78-
- name: Install dependencies
79-
run: |
80-
sudo apt-get update
81-
sudo apt-get install -y make gcc binutils linux-headers-generic \
82-
libarchive-tools btrfs-progs libseccomp-dev pkg-config cpio libkmod-dev
83-
84-
- name: Create rootfs containing the local Linux-GCS
85-
run: |
86-
chmod a+x ${{ github.workspace }}/hack/catcpio.sh
87-
88-
# Find the full file name for rootfs tar
89-
ROOTFS_TAR=$(ls temp_rootfs/rootfs-*.tar.gz | head -n 1)
90-
echo "The full file name is $ROOTFS_TAR"
91-
92-
make clean
93-
sudo make KMOD=1 BASE=${{ github.workspace }}/$ROOTFS_TAR rootfs
94-
95-
- name: Move newly created rootfs.vhd and initrd.img
96-
run: |
97-
mv out/rootfs.vhd ${{ env.LINUX_BOOT_FILES_PATH }}/
98-
mv out/initrd.img ${{ env.LINUX_BOOT_FILES_PATH }}/
76+
mv ./downloaded_artifacts/LinuxBootFiles/kernel ./linux_artifacts/
77+
mv ./downloaded_artifacts/LinuxBootFiles/vmlinux ./linux_artifacts/
78+
mv ./downloaded_artifacts/rootfs-*.tar.gz ./linux_artifacts/
9979
10080
# This is a workaround to overcome the limitation of actions/upload-artifact@v4 used in later jobs.
10181
# See https://github.com/actions/upload-artifact/tree/v4/?tab=readme-ov-file#permission-loss.
10282
- name: Tar the files to preserve file permissions prior to upload
10383
run: |
104-
cd ${{ env.LINUX_BOOT_FILES_PATH }}
105-
tar -cvf ../linux_boot_files.tar .
84+
cd linux_artifacts
85+
tar -cvf linux_artifacts.tar .
10686
10787
# Upload the Linux boot files so that they can be used in later jobs.
108-
- name: Upload Linux boot files to artifact
88+
- name: Upload Linux artifact
10989
uses: actions/upload-artifact@v4
11090
with:
11191
name: linux_artifact
112-
path: linux_boot_files.tar
92+
path: linux_artifact.tar
11393
if-no-files-found: error
11494
overwrite: true
11595
retention-days: 1

0 commit comments

Comments
 (0)