Skip to content

Commit

Permalink
feat: add talosctl
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Dec 25, 2023
1 parent 67e8c33 commit d2cfce6
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Run all the linters
'on': workflow_call

'on':
workflow_dispatch:
push:

jobs:
lint:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yamllint disable rule:comments
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Run all the tests
Expand Down Expand Up @@ -135,3 +136,4 @@ jobs:
- name: Check build matrix status
if: ${{ needs.test.result != 'success' }}
run: exit 1
# yamllint enable rule:comments
23 changes: 23 additions & 0 deletions apps/talosctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG TARGETPLATFORM
ARG VERSION
FROM ghcr.io/foxcpp/maddy:${VERSION} as source

FROM ghcr.io/deedee-ops/alpine:3.19.0

ARG TARGETPLATFORM
ARG VERSION
ARG CHANNEL

#hadolint ignore=DL3018
RUN apk add --no-cache bash curl yq \
&& curl -sL -o /usr/bin/talosctl https://github.com/siderolabs/talos/releases/download/v${VERSION}/talosctl-linux-amd64 \
&& chmod +x /usr/bin/talosctl

COPY --chmod=0755 --chown=65000:65000 entrypoint.sh /usr/local/bin/entrypoint.sh

USER 65000:65000
VOLUME ["/tmp"]
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/base-entrypoint.sh", "/usr/local/bin/entrypoint.sh"]
CMD ["env"]

LABEL org.opencontainers.image.source="https://github.com/siderolabs/talos/"
24 changes: 24 additions & 0 deletions apps/talosctl/ci/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# https://github.com/goss-org/goss/blob/master/docs/manual.md#group
group:
abc:
exists: true
gid: 65000
# https://github.com/goss-org/goss/blob/master/docs/manual.md#file
file:
/usr/local/bin/base-entrypoint.sh:
exists: true
mode: "0755"
/usr/local/bin/entrypoint.sh:
exists: true
mode: "0755"
# https://github.com/goss-org/goss/blob/master/docs/manual.md#mount
mount:
/tmp:
exists: true
# https://github.com/goss-org/goss/blob/master/docs/manual.md#user
user:
abc:
exists: true
uid: 65000
gid: 65000
11 changes: 11 additions & 0 deletions apps/talosctl/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

if [ -n "${TALOS_NODE_IP}" ]; then
TALOS_IMAGE_NAME="$(talosctl -n "${TALOS_NODE_IP}" read /system/state/config.yaml | yq '.machine.install.image' | sed 's@[email protected]/siderolabs/installer@g' | sed 's@:.*@@g')"

export TALOS_IMAGE_NAME
fi

echo "DEBUG: ${*/\$(TALOS_IMAGE_NAME)/${TALOS_IMAGE_NAME}}"

exec "${@/\$(TALOS_IMAGE_NAME)/${TALOS_IMAGE_NAME}}"
17 changes: 17 additions & 0 deletions apps/talosctl/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"app": "talosctl",
"base": false,
"testMuteCmd": true,
"channels": [
{
"name": "stable",
"renovate::dataSource": "docker",
"renovate::depName": "ghcr.io/siderolabs/talosctl",
"version": "1.6.0",
"platforms": [
"linux/amd64",
"linux/arm64"
]
}
]
}

0 comments on commit d2cfce6

Please sign in to comment.