Reduce binary sizes (#710)

* Compress agent and reduce docs

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Kcrypt

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Kcrypt-challenger

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* provider-kairos

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Edgevpn

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* toolchain

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* multiarch toolchain

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* remove docs from agent

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* k9s

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* k3s

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* kubectl

* nerdctl

* revert docs changes, will be removed

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

---------

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
This commit is contained in:
Mauro Morales 2024-02-26 21:26:00 +01:00 committed by GitHub
parent 821de2dded
commit 26b74dacca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 72 additions and 49 deletions

View File

@ -1,5 +1,5 @@
requires:
- name: "toolchain-go"
- name: "toolchain-go-ubuntu"
category: "development"
version: ">=0"
env:
@ -31,6 +31,7 @@ steps:
- bash installer.sh agent
- rm -rf installer.sh
- chmod +x /usr/bin/k3s
- upx -1 /usr/bin/k3s
- TAG=$INSTALL_K3S_VERSION ./fetch-template.sh
- mkdir -p /usr/share/config/kairos/k3s/
- mv config.toml.tmpl /usr/share/config/kairos/k3s/containerd-config.toml.tmpl

View File

@ -40,7 +40,7 @@ packages:
- name: k3s-systemd
category: k8s
version: "1.29.0+2"
version: "1.29.0+3"
k3s_version: "2"
labels:
github.owner: "k3s-io"
@ -53,7 +53,7 @@ packages:
- name: k3s-systemd
category: k8s
version: "1.28.5+2"
version: "1.28.5+3"
k3s_version: "2"
labels:
github.owner: "k3s-io"
@ -66,7 +66,7 @@ packages:
- name: k3s-systemd
category: k8s
version: "1.27.9+2"
version: "1.27.9+3"
k3s_version: "2"
labels:
github.owner: "k3s-io"

View File

@ -25,24 +25,12 @@ env:
- CGO_ENABLED=0
- LDFLAGS="-s -w -X github.com/kairos-io/kairos-agent/v2/internal/common.VERSION=v${PACKAGE_VERSION} {{with .Values.ldflags}}{{.}}{{end}}"
{{end}}
copy:
- package:
category: "static"
name: "kairos-docs"
version: ">=0"
source: "/usr/share/doc/kairos"
destination: "/kairos-docs/"
steps:
# Docs for webui, copy them from the package
- mkdir -p /go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/internal/webui/public/local
- cp -r /kairos-docs/* /go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/internal/webui/public/local/
# Deps for webui
- cd /go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/internal/webui/public && npm install
# Now for the real binary with everything bundled!
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \
cd /go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && \
go build -ldflags="${LDFLAGS}" -o /usr/bin/{{ .Values.name }}
- upx -1 /usr/bin/{{.Values.name}}
- chmod +x /usr/bin/{{.Values.name}}
{{if or (eq .Values.category "fips") (eq .Values.category "fips-static")}}
{{ if .Values.arch }}

View File

@ -1,7 +1,7 @@
packages:
- name: "kairos-agent"
category: "system"
version: "2.7.13"
version: "2.7.13+2"
labels:
github.repo: "kairos-agent"
autobump.revdeps: "true"

View File

@ -10,11 +10,11 @@ requires:
version: ">=0"
{{end}}
prelude:
{{if or (eq .Values.category "fips") (eq .Values.category "fips-static")}}
- apt-get update && apt-get install -y gcc
{{end}}
{{if not (or (eq .Values.category "fips") (eq .Values.category "fips-static"))}}
- apt-get install -y libssl-dev
{{ end }}
- mkdir go/src/github.com/${GITHUB_ORG}/ -p
- apt-get update && apt-get install -y gcc libssl-dev
- cd go/src/github.com/${GITHUB_ORG}/ && git clone https://github.com/${GITHUB_ORG}/{{ .Values.name }}.git
{{ if ne .Values.live "yes" }}
- cd go/src/github.com/${GITHUB_ORG}/ && git checkout 3912abcec424521725ccd335181f2fde90510081 -b build
@ -27,15 +27,18 @@ env:
{{if or (eq .Values.category "fips") (eq .Values.category "fips-static")}}
- CGO_ENABLED=1
- GOEXPERIMENT=boringcrypto
- LDFLAGS="-w {{with .Values.ldflags}}{{.}}{{end}}"
{{else}}
- CGO_ENABLED=0
- LDFLAGS="-s -w {{with .Values.ldflags}}{{.}}{{end}}"
{{end}}
steps:
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \
mkdir -p /system/discovery && \
cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && go build -ldflags="{{with .Values.ldflags}}{{.}}{{end}}" -o {{ .Values.binary_name }} ./cmd/discovery/main.go && mv {{ .Values.binary_name }} /system/discovery
cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && go build -ldflags="${LDFLAGS}" -o {{ .Values.binary_name }} ./cmd/discovery/main.go && mv {{ .Values.binary_name }} /system/discovery
- upx -1 /system/discovery/{{ .Values.binary_name }}
- chmod +x /system/discovery/{{ .Values.binary_name }}
{{if or (eq .Values.category "fips") (eq .Values.category "fips-static")}}
{{ if .Values.arch }}

View File

@ -3,7 +3,7 @@ packages:
binary_name: kcrypt-discovery-challenger
category: system
live: "yes"
version: "0.7.0"
version: "0.7.0+1"
labels:
github.repo: "kcrypt-challenger"
github.owner: "kairos-io"

View File

@ -30,6 +30,7 @@ steps:
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \
cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && git checkout v"${PACKAGE_VERSION}" -b build && go build -ldflags="${LDFLAGS}" && mv {{.Values.name}} /usr/bin/
- upx -1 /usr/bin/{{.Values.name}}
- chmod +x /usr/bin/{{.Values.name}}
{{if or (eq .Values.category "fips") (eq .Values.category "fips-static")}}
{{ if .Values.arch }}

View File

@ -1,7 +1,7 @@
packages:
- name: kcrypt
category: system
version: "0.9.1"
version: "0.9.1+1"
labels:
github.repo: "kcrypt"
autobump.revdeps: "true"

View File

@ -1,10 +1,13 @@
image: golang:1.20
requires:
- name: "toolchain-go-ubuntu"
category: "development"
version: ">=0"
env:
- CGO_ENABLED=0
- LDFLAGS="-s -w -X 'github.com/kairos-io/provider-kairos/v2/internal/cli.VERSION={{ .Values.version }}'"
- PACKAGE_VERSION={{ .Values.tag }}
- LDFLAGS="-s -w -X 'github.com/kairos-io/provider-kairos/v2/internal/cli.VERSION={{ .Values.tag }}'"
prelude:
- apt-get update
- apt-get install -y git
- apt-get update && apt-get install -y git
- git clone https://github.com/kairos-io/provider-kairos
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\-*} && \
@ -13,6 +16,7 @@ steps:
- mkdir -p /system/providers
- cd provider-kairos && go build -ldflags "${LDFLAGS}" -o agent-provider-kairos
- mv provider-kairos/agent-provider-kairos /system/providers/agent-provider-kairos
- upx -1 /system/providers/agent-provider-kairos
- ln -s /system/providers/agent-provider-kairos /usr/bin/kairos
includes:

View File

@ -1,7 +1,8 @@
packages:
- name: "provider-kairos"
category: "system"
version: "2.6.3"
version: "2.6.3+1"
tag: "2.6.3"
labels:
github.repo: "provider-kairos"
github.owner: "kairos-io"

View File

@ -1,11 +1,19 @@
{{ if .Values.variant }}
image: "golang:{{.Values.version}}-{{.Values.variant}}"
image: "golang:{{.Values.tag}}-{{.Values.variant}}"
{{ else }}
image: "golang:{{.Values.version}}"
image: "golang:{{.Values.tag}}"
{{ end }}
{{ if eq .Values.variant "alpine" }}
prelude:
{{ if eq .Values.variant "alpine" }}
- apk update
- apk add curl make git bash
{{ end }}
{{ if eq .Values.variant "bookworm" }}
- apt-get update && apt-get install -y curl xz-utils
- curl -LO https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-{{ .Values.arch }}_linux.tar.xz
- tar -xvf upx-4.2.2-{{ .Values.arch }}_linux.tar.xz
- mv upx-4.2.2-{{ .Values.arch }}_linux/upx /usr/bin/
- rm -rf upx-4.2.2-{{ .Values.arch }}_linux
- chmod +x /usr/bin/upx
{{ end }}

View File

@ -3,6 +3,7 @@ packages:
category: development
variant: "alpine"
version: "1.21.6"
tag: "1.21.6"
hidden: true
labels:
autobump.revdeps: "false"
@ -15,9 +16,10 @@ packages:
curl -s -L "https://go.dev/dl/?mode=json" |jq -r '.[0].version'| sed 's/go//g'
package.version: "1.21.6"
- name: toolchain-go-ubuntu
variant: ""
variant: "bookworm"
category: development
version: "1.21.6"
version: "1.21.7+2"
tag: "1.21.7"
hidden: true
labels:
autobump.revdeps: "false"
@ -28,11 +30,12 @@ packages:
curl -s -L "https://go.dev/dl/?mode=json" |jq -r '.[0].version'| sed 's/go//g'
autobump.version_hook: |
curl -s -L "https://go.dev/dl/?mode=json" |jq -r '.[0].version'| sed 's/go//g'
package.version: "1.21.6"
package.version: "1.21.7"
- name: toolchain-go
category: development
variant: "alpine"
version: "1.20.2"
tag: "1.20.2"
hidden: true
labels:
autobump.revdeps: "false"
@ -44,9 +47,10 @@ packages:
autobump.version_hook: |
curl -s -L "https://go.dev/dl/?mode=json" |jq -r '.[0].version'| sed 's/go//g'
- name: toolchain-go-ubuntu
variant: ""
variant: "bookworm"
category: development
version: "1.20.2"
tag: "1.20.2"
hidden: true
labels:
autobump.revdeps: "false"
@ -64,7 +68,7 @@ packages:
tag: "1.19.10"
hidden: true
- name: toolchain-go-ubuntu
variant: ""
variant: "bookworm"
category: fips
version: "1.19.10"
tag: "1.19.10"
@ -76,7 +80,7 @@ packages:
tag: "1.19.10"
hidden: true
- name: toolchain-go-ubuntu
variant: ""
variant: "bookworm"
category: fips
version: "1.19.10"
tag: "1.19.10"

View File

@ -1,5 +1,5 @@
requires:
- name: "toolchain-go"
- name: "toolchain-go-ubuntu"
category: "development"
version: ">=0"
prelude:
@ -9,10 +9,12 @@ env:
- GOPATH=/luetbuild/go/
- GITHUB_ORG={{ ( index .Values.labels "github.owner" ) }}
- CGO_ENABLED=0
- PACKAGE_VERSION={{ .Values.tag }}
steps:
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\-*} && \
cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && git checkout v"${PACKAGE_VERSION}" -b build && go build -ldflags="-w -s -X github.com/mudler/edgevpn/internal.Version=v$PACKAGE_VERSION" && mv {{.Values.name}} /usr/bin/
- upx -1 /usr/bin/{{.Values.name}}
- chmod +x /usr/bin/{{.Values.name}}
includes:
- /usr/bin/{{.Values.name}}

View File

@ -1,6 +1,7 @@
name: edgevpn
category: utils
version: "0.24.6"
version: "0.24.6+1"
tag: "0.24.6"
labels:
github.repo: "edgevpn"
github.owner: "mudler"

View File

@ -1,10 +1,11 @@
requires:
- name: "toolchain-go"
- name: "toolchain-go-ubuntu"
category: "development"
version: ">=0"
env:
- PATH=$PATH:/usr/local/go/bin
- CGO_ENABLED=0
- PACKAGE_VERSION={{ .Values.tag }}
prelude:
- |
PACKAGE_VERSION=v${PACKAGE_VERSION%\-*} && \
@ -13,6 +14,8 @@ steps:
- |
cd k9s && \
make build && \
cp execs/k9s /usr/bin
cp execs/k9s /usr/bin && \
upx /usr/bin/k9s
includes:
- /usr/bin/k9s

View File

@ -1,6 +1,7 @@
name: "k9s"
category: "utils"
version: "0.31.7"
version: "0.31.7+1"
tag: "0.31.7"
platform: Linux
labels:
github.repo: "k9s"

View File

@ -1,12 +1,13 @@
requires:
- category: "development"
name: "toolchain-go"
name: "toolchain-go-ubuntu"
version: ">=0"
package_dir: /kubectl
env:
- PACKAGE_VERSION={{ .Values.tag }}
steps:
- apk add bash
- mkdir -p /kubectl/usr/bin
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && curl -LO "https://dl.k8s.io/release/v$PACKAGE_VERSION/bin/linux/{{.Values.arch}}/kubectl"
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && curl -LO "https://dl.k8s.io/release/v$PACKAGE_VERSION/bin/linux/{{.Values.arch}}/kubectl.sha256"
@ -16,3 +17,4 @@ steps:
- /bin/bash -c 'echo "$(<kubectl.sha256) kubectl" | sha256sum -c'
- mv kubectl /kubectl/usr/bin
- chmod +x /kubectl/usr/bin/kubectl
- upx -1 /kubectl/usr/bin/kubectl

View File

@ -1,6 +1,7 @@
name: kubectl
category: container
version: "1.29.1"
version: "1.29.1+1"
tag: "1.29.1"
arch: "amd64"
labels:
github.repo: "kubectl"

View File

@ -1,10 +1,11 @@
requires:
- name: "toolchain-go"
- name: "toolchain-go-ubuntu"
category: "development"
version: ">=0"
env:
- PATH=$PATH:/usr/local/go/bin
- CGO_ENABLED=0
- PACKAGE_VERSION={{ .Values.tag }}
prelude:
- |
PACKAGE_VERSION=v${PACKAGE_VERSION%\-*} && \
@ -13,6 +14,7 @@ steps:
- |
cd nerdctl && \
make binaries && \
make BINDIR=/usr/bin install
make BINDIR=/usr/bin install && \
upx -1 /usr/bin/nerdctl
includes:
- /usr/bin/nerdctl

View File

@ -1,6 +1,7 @@
name: "nerdctl"
category: "utils"
version: "1.7.2"
version: "1.7.2+1"
tag: "1.7.2"
platform: linux
labels:
github.repo: "nerdctl"