forked from playtron-os/playtron-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
226 lines (207 loc) · 9.46 KB
/
Taskfile.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Playtron OS Taskfile
# https://taskfile.dev
version: "3"
env:
IMAGE: playtronos
PUBLIC_IMAGE: playtron-os
tasks:
rpm-repo:
desc: Build a local rpm-ostree repository with local RPMs.
dir: rpm-ostree
cmds:
- mkdir -p /tmp/repo || true
- echo "Checking if any RPMs exist in the /tmp/repo/ directory..."
- ls /tmp/repo | grep rpm || exit 1
- createrepo /tmp/repo
- grep " - local" playtron-os.yaml || sed -i s'/repos:/repos:\n - local'/g playtron-os.yaml
- echo -e "[local]\nname=local\nbaseurl=file:///tmp/repo\nenabled=1\nrepo_gpgcheck=0\ngpgcheck=0" > local.repo
container-image:auth:
desc: Authenticate with the container registry.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: test -n "$REGISTRY_TOKEN"
msg: "A value for REGISTRY_TOKEN must be provided"
cmds:
- mkdir -p ${XDG_RUNTIME_DIR}/containers
- echo "{ \"auths\":{ \"${REGISTRY}\":{ \"auth\":\"${REGISTRY_TOKEN}\" } } }" > "${XDG_RUNTIME_DIR}/containers/auth.json"
container-image:build-base:
desc: Build the base OCI container image.
dir: rpm-ostree
preconditions:
- sh: test "$EUID" == 0
msg: "This task must be run as root"
cmds:
- rpm-ostree compose image --initialize-mode=always --format=ociarchive playtron-os.yaml playtron-os-base.ociarchive
container-image:build-base-bleeding-edge:
desc: Build the base OCI container image using kernel-mainline and mesa-git packages.
dir: rpm-ostree
cmds:
- sed -i s'/enabled=0/enabled=1/'g kernel-mainline-wo-mergew.repo
- sed -i s'/enabled=0/enabled=1/'g mesa-git-x86_64.repo
- sed -i s'/enabled=0/enabled=1/'g mesa-git-i686.repo
- sed -i s'/#- kernel-mainline-wo-mergew/- kernel-mainline-wo-mergew/'g playtron-os.yaml
- sed -i s'/#- mesa-git-x86_64/- mesa-git-x86_64/'g playtron-os.yaml
- sed -i s'/#- mesa-git-i686/- mesa-git-i686/'g playtron-os.yaml
- task: container-image:build-base
container-image:load-base:
desc: Load the base OCI container image.
dir: rpm-ostree
preconditions:
- sh: test -f playtron-os-base.ociarchive
msg: "No base image archive found. Please use `container-image:build-base` to build a base image first."
cmds:
- cat playtron-os-base.ociarchive | podman load 2>&1 | grep "Loaded image" | cut -d':' -f3 > imported-base-sha256
- rm -f playtron-os-base.ociarchive
- podman tag $(cat imported-base-sha256) playtron-os-base:local
container-image:build:
desc: Build the OCI container image.
dir: rpm-ostree
preconditions:
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
cmds:
- mkdir -p rootfs/usr/lib
- cat os-release.template | envsubst '${TAG}' > rootfs/usr/lib/os-release-playtron
- podman build --no-cache --tag ${IMAGE}:${TAG} --file containerfiles/unstable .
container-image:build-stable:
desc: Build the OCI container image using the stable containerfile.
dir: rpm-ostree
preconditions:
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
cmds:
- mkdir -p rootfs/usr/lib
- cat os-release.template | envsubst '${TAG}' > rootfs/usr/lib/os-release-playtron
- podman build --no-cache --tag ${IMAGE}:${TAG} --file containerfiles/stable .
container-image:push:
desc: Push the OCI container image to the container registry.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
cmds:
- podman push ${IMAGE}:${TAG} ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG}
- podman push ${IMAGE}:${TAG} ${REGISTRY}/${PROJECT}/${IMAGE}:testing
container-image:release:
desc: Release the OCI container image by tagging it as `latest` in the container registry.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
cmds:
- podman pull ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG}
- podman push ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} ${REGISTRY}/${PROJECT}/${IMAGE}:latest
container-image:inspect:
desc: Inspect the OCI container image by opening a shell inside the container.
preconditions:
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
cmds:
- podman run -it ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} bash
disk-image:
desc: Build the OS image from a container hosted in a registry.
dir: kickstart
env:
TAG: latest
PROJECT: playtron-os
REGISTRY: ghcr.io
IMAGE: playtron-os
REGISTRY_TOKEN:
preconditions:
- sh: test "$EUID" == 0
msg: "This task must be run as root"
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
- sh: test -n "$IMAGE"
msg: "A value for IMAGE must be provided"
cmds:
- cat playtron-os_kickstart.cfg.template | envsubst '${REGISTRY} ${REGISTRY_TOKEN} ${PROJECT} ${IMAGE} ${TAG}' > playtron-os_kickstart.cfg
- sudo setenforce 0
- ./virt-install.sh
- mv /var/lib/libvirt/images/playtron-os.img "/var/lib/libvirt/images/playtron-os.img_$(date -Iseconds)"
- virsh undefine --nvram playtron-os
repo:update:
desc: "Update the package repository"
cmds:
- rm -rf /tmp/repo
- mkdir -p /tmp/repo
- aws s3 cp s3://playtron-dev2-global-os-public/repos/playtron-app/x86_64/ /tmp/repo/ --recursive
- read -p "Copy new packages into /tmp/repo and press ENTER to continue"
- createrepo /tmp/repo
- aws s3 sync /tmp/repo/ s3://playtron-dev2-global-os-public/repos/playtron-app/x86_64/
public:auth:
desc: Authenticate with the GitHub container registry.
preconditions:
- sh: test -n "$GITHUB_USER"
msg: "A value for GITHUB_USER must be provided"
- sh: test -n "$GITHUB_TOKEN"
msg: "A value for GITHUB_TOKEN must be provided"
cmds:
- echo $GITHUB_TOKEN | podman login ghcr.io -u $GITHUB_USER --password-stdin
public:push:
desc: Publish the container to the public registry with the tag 'testing'.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: grep "ghcr.io" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `public:auth` to authenticate with the GitHub registry"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
cmds:
- podman pull ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG}
- podman push ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} ghcr.io/playtron-os/${PUBLIC_IMAGE}:${TAG}
- podman push ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} ghcr.io/playtron-os/${PUBLIC_IMAGE}:testing
public:release:
desc: Publish the container to the public registry with the tag 'latest'.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: grep "ghcr.io" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `public:auth` to authenticate with the GitHub registry"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
cmds:
- podman pull ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG}
- podman push ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} ghcr.io/playtron-os/${PUBLIC_IMAGE}:${TAG}
- podman push ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} ghcr.io/playtron-os/${PUBLIC_IMAGE}:latest
package-list:
desc: Publish the container to the public registry with the tag 'latest'.
preconditions:
- sh: test -n "$REGISTRY"
msg: "A value for REGISTRY must be provided"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: grep "${REGISTRY}" "${XDG_RUNTIME_DIR}/containers/auth.json"
msg: "Please use `container-image:auth` to authenticate with the registry"
- sh: test -n "$PROJECT"
msg: "A value for PROJECT must be provided"
- sh: test -n "$TAG"
msg: "A value for TAG must be provided"
cmds:
- podman pull ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG}
- podman run -it ${REGISTRY}/${PROJECT}/${IMAGE}:${TAG} rpm -qa | sort -u > playtron-os-${TAG}.pkg-list.txt