-
-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (126 loc) · 5.83 KB
/
nightly-noble.yaml
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
{
"jobs": {
"build-noble": {
"runs-on": "ubuntu-22.04",
"steps": [
{
"uses": "actions/checkout@v4"
},
{
"uses": "catchpoint/workflow-telemetry-action@v2"
},
{
"uses": "Kesin11/actions-timeline@v2"
},
{
"uses": "whywaita/setup-lxd@v1"
},
{
"name": "Setup distrobuilder",
"run": "sudo snap install distrobuilder --classic",
"shell": "bash"
},
{
"name": "Delete unused file",
"run": "sudo rm -rf /opt/\nsudo rm -rf /usr/local/*\nsudo rm -rf /usr/local/.ghcup\nsudo rm -rf /usr/lib/jvm /usr/lib/google-cloud-sdk\nsudo rm -rf /home/runneradmin /home/linuxbrew\nsudo rm -rf /home/runner/runners/*.tar.gz\n# ignore /var/run, snap lxd packages, apt\nsudo ls /var/**/** | grep \":\" | tr -d \":\" | grep -Ev \"/var/run|/var/snap/lxd|/var/lib/snapd|/var/lib/dpkg\" | xargs -I%% sudo rm -rf %%\n# ignore /usr/share/dpkg\nls /usr/share/ | grep -vE \"dpkg|debconf|dbus\" | xargs -I%% sudo rm -rf /usr/share/%%\n\nsudo mkdir -p /opt\nsudo chmod 777 /opt\n",
"shell": "bash"
},
{
"uses": "hashicorp/setup-packer@main"
},
{
"name": "Display storage information",
"run": "df -Th",
"shell": "bash"
},
{
"name": "Clone actions/runner-images",
"run": "git clone --depth 1 https://github.com/actions/runner-images\ncd runner-images\nexport DIR=$(pwd)\necho \"dir=${DIR}\" >> $GITHUB_ENV\necho \"virtual-environments-hash=$(git rev-parse --short HEAD)\" >> $GITHUB_ENV\necho \"build-date=$(date '+%Y%m%d')\" >> $GITHUB_ENV\necho \"os-release=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d'=' -f2)\" >> $GITHUB_ENV\n",
"shell": "bash"
},
{
"if": "${{ env.os-release == '22.04' }}",
"name": "Clear duplicate entry in nftables (only jammy)",
"run": "# ref: https://discuss.linuxcontainers.org/t/lxdbr0-firewall-problem-with-ubuntu-22-04-host-running-docker-and-lxd/15298/9\nsudo nft flush ruleset\nsudo systemctl restart snap.lxd.daemon\n",
"shell": "bash"
},
{
"name": "Apply LXD patch",
"run": "cp ../lxd.patch .\npatch -p1 < lxd.patch\n",
"shell": "bash",
"working-directory": "${{ env.dir }}"
},
{
"name": "packer init",
"run": "packer init images/ubuntu/templates/ubuntu-24.04.pkr.hcl",
"shell": "bash",
"working-directory": "${{ env.dir }}"
},
{
"name": "packer validate packer.json",
"run": "packer validate -syntax-only images/ubuntu/templates/ubuntu-24.04.pkr.hcl",
"shell": "bash",
"working-directory": "${{ env.dir }}"
},
{
"env": {
"PACKER_LOG": 1
},
"name": "packer build packer.json",
"run": "packer build -on-error=abort images/ubuntu/templates/ubuntu-24.04.pkr.hcl",
"shell": "bash",
"working-directory": "${{ env.dir }}"
},
{
"name": "Stop container",
"run": "lxc stop packer-lxd",
"shell": "bash"
},
{
"name": "Remove swap",
"run": "sudo swapoff /mnt/swapfile\nsudo rm -rf /mnt/swapfile\n",
"shell": "bash"
},
{
"name": "Build by distrobuilder",
"run": "sudo mkdir -p /mnt/cache\nsudo mkdir -p /mnt/output\nsudo distrobuilder pack-lxd distrobuilder-def.yaml \"/var/snap/lxd/common/lxd/storage-pools/default/containers/packer-lxd\" /mnt/output --cache-dir /mnt/cache\n\nset -x\nls -l /mnt/output\n",
"shell": "bash"
},
{
"name": "Remove container",
"run": "lxc delete packer-lxd",
"shell": "bash"
},
{
"name": "Upload artifact",
"uses": "actions/upload-artifact@v4",
"with": {
"name": "virtual-environments-lxd-24.04-${{ env.virtual-environments-hash }}-${{ env.build-date }}.zip",
"path": "/mnt/output/*",
"retention-days": 5
}
},
{
"env": {
"SLACK_WEBHOOK_TYPE": "INCOMING_WEBHOOK",
"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}"
},
"name": "Notify",
"uses": "slackapi/slack-github-action@v1",
"with": {
"payload": "{\n \"blocks\": [\n {\n \"type\": \"section\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"Build actions-image-runner-lxd ${{ github.workflow }} is ${{ job.status }}\"\n }\n },\n {\n \"type\": \"section\",\n \"fields\": [\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Repository*: <https://github.com/whywaita/actions-runner-images-lxd|whywaita/actions-runner-images-lxd>\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \":arrow_right: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View action>\"\n }\n ]\n }\n ]\n}\n"
}
}
]
}
},
"name": "Build image (nightly) - noble",
"on": {
"schedule": [
{
"cron": "0 22 * * *"
}
],
"workflow_dispatch": { }
}
}