Skip to content

Commit 69ac6ce

Browse files
committed
feat(ci): scan VM using quay.io
Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
1 parent 725de50 commit 69ac6ce

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,36 @@ jobs:
101101
- run: mise run microshift-vm:build:qemu --arch ${{ matrix.arch }}
102102
- if: matrix.arch == 'x86_64'
103103
run: mise run microshift-vm:build:wsl
104-
- name: Upload Release Asset
105-
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6dc5a # v2
104+
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6dc5a # v2
106105
with:
107106
files: |
108107
apps/microshift-vm/dist/${{ matrix.arch }}/microshift-vm-${{ matrix.arch }}.qcow2
109108
${{ matrix.arch == 'x86_64' && format('apps/microshift-vm/dist/{0}/microshift-vm-{0}.wsl', matrix.arch) || '' }}
109+
- if: matrix.arch == 'x86_64'
110+
id: version
111+
run: |
112+
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
113+
echo "latestTag=$([[ ${GITHUB_REF#refs/tags/v} =~ [a-zA-Z] ]] && echo prerelease || echo latest)" >> $GITHUB_OUTPUT
114+
- if: matrix.arch == 'x86_64'
115+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
116+
with:
117+
registry: quay.io
118+
username: beeai+github
119+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
120+
- if: matrix.arch == 'x86_64'
121+
run: mise run microshift-vm:build:container --arch x86_64
122+
- if: matrix.arch == 'x86_64'
123+
run: |
124+
docker import \
125+
--platform linux/amd64 \
126+
-c 'CMD ["/sbin/init"]' \
127+
./apps/microshift-vm/dist/x86_64/microshift-vm-x86_64.tar.gz \
128+
"quay.io/beeai/microshift-vm:${{ steps.version.outputs.version }}"
129+
docker push "quay.io/beeai/microshift-vm:${{ steps.version.outputs.version }}"
130+
docker tag \
131+
"quay.io/beeai/microshift-vm:${{ steps.version.outputs.version }}" \
132+
"quay.io/beeai/microshift-vm:${{ steps.version.outputs.latestTag }}"
133+
docker push "quay.io/beeai/microshift-vm:${{ steps.version.outputs.latestTag }}"
110134
111135
agentstack:
112136
needs: [agents, vm]
@@ -224,8 +248,7 @@ jobs:
224248
with:
225249
packages-dir: apps/agentstack-cli/dist
226250

227-
- name: Publish TS SDK
228-
working-directory: apps/agentstack-sdk-ts
251+
- working-directory: apps/agentstack-sdk-ts
229252
run: npm publish --tag ${{ steps.version.outputs.npmTag }}
230253

231254
- run: |

apps/microshift-vm/tasks.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,29 @@ tar -c --numeric-owner --exclude=./proc --exclude=./sys --exclude=./dev --exclud
9090
'''
9191
sources = ["microshift.pkr.hcl", "cloud-init/*", "rootfs/**/*", "install.sh", "wsl/*"]
9292
outputs = ["dist/**/*.wsl"]
93+
94+
["microshift-vm:build:container"]
95+
depends = ["microshift-vm:build:qemu"]
96+
dir = "{{config_root}}/apps/microshift-vm"
97+
usage = '''
98+
flag "--arch <arch>" {
99+
choices "x86_64" "aarch64"
100+
}
101+
'''
102+
run = '''
103+
#!/bin/bash
104+
set -euxo pipefail
105+
106+
ARCH=${usage_arch:-$(uname -m | sed -e 's/arm64/aarch64/;s/amd64/x86_64/')}
107+
DIST_DIR="./dist/$ARCH"
108+
109+
MOUNTPOINT=$(mktemp -d)
110+
trap 'guestunmount "$MOUNTPOINT" 2>/dev/null; rmdir "$MOUNTPOINT" 2>/dev/null' EXIT
111+
guestmount -a "$DIST_DIR/microshift-vm-$ARCH.qcow2" -i --ro "$MOUNTPOINT"
112+
rm -f "$MOUNTPOINT/etc/resolv.conf"
113+
tar -c --numeric-owner \
114+
--exclude=./proc --exclude=./sys --exclude=./dev --exclude=./run --exclude=./mnt \
115+
-C "$MOUNTPOINT" . | gzip --best > "$DIST_DIR/microshift-vm-$ARCH.tar.gz"
116+
'''
117+
sources = ["microshift.pkr.hcl", "cloud-init/*", "rootfs/**/*", "install.sh"]
118+
outputs = ["dist/**/*.tar.gz"]

0 commit comments

Comments
 (0)