mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-04-27 11:21:44 +00:00
reuse same base image across all targets (#202)
This commit is contained in:
parent
7b3149e9ce
commit
96d9f402a1
2
.github/cypress_tests.sh
vendored
2
.github/cypress_tests.sh
vendored
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
# Run agent in the background to bring the webui up
|
||||
/usr/bin/kairos-agent webui &
|
||||
|
||||
|
2
.github/workflows/unit-tests.yml
vendored
2
.github/workflows/unit-tests.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
# Match this version to the maintained FIPS version in packages at https://github.com/kairos-io/packages/blob/main/packages/toolchain-go/collection.yaml#L63
|
||||
go-version: ["1.19.10-alpine3.18", "1.20-alpine3.18", "1.21-alpine3.18"]
|
||||
go-version: ["1.19.10-bookworm", "1.20-bookworm", "1.21-bookworm"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
2
.github/workflows/webui.yaml
vendored
2
.github/workflows/webui.yaml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
# Match this version to the maintained FIPS version in packages at https://github.com/kairos-io/packages/blob/main/packages/toolchain-go/collection.yaml#L63
|
||||
go-version: [ "1.19.10-alpine3.18", "1.20-alpine3.18", "1.21-alpine3.18" ]
|
||||
go-version: [ "1.19.10-bookworm", "1.20-bookworm", "1.21-bookworm" ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
15
Earthfile
15
Earthfile
@ -3,13 +3,14 @@ FROM alpine
|
||||
# renovate: datasource=docker depName=golang
|
||||
ARG --global GOLINT_VERSION=1.52.2
|
||||
# renovate: datasource=docker depName=golang
|
||||
ARG --global GO_VERSION=1.20-alpine3.17
|
||||
ARG --global GO_VERSION=1.20-bookworm
|
||||
# renovate: datasource=docker depName=cypress/base
|
||||
ARG --global CYPRESS_VERSION=18.16.0
|
||||
|
||||
go-deps:
|
||||
ARG GO_VERSION
|
||||
FROM golang:$GO_VERSION
|
||||
RUN apt-get update && apt-get install -y rsync gcc bash git
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
@ -18,7 +19,6 @@ go-deps:
|
||||
|
||||
test:
|
||||
FROM +go-deps
|
||||
RUN apk add rsync gcc musl-dev bash
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
ARG TEST_PATHS=./...
|
||||
@ -28,8 +28,7 @@ test:
|
||||
SAVE ARTIFACT coverage.out AS LOCAL coverage.out
|
||||
|
||||
version:
|
||||
FROM alpine
|
||||
RUN apk add git
|
||||
FROM +go-deps
|
||||
COPY . ./
|
||||
RUN --no-cache echo $(git describe --always --tags --dirty) > VERSION
|
||||
RUN --no-cache echo $(git describe --always --dirty) > COMMIT
|
||||
@ -40,7 +39,6 @@ version:
|
||||
|
||||
build-kairos-agent:
|
||||
FROM +go-deps
|
||||
RUN apk add upx
|
||||
COPY . .
|
||||
COPY +webui-deps/node_modules ./internal/webui/public/node_modules
|
||||
COPY github.com/kairos-io/kairos-docs:main+docs/public ./internal/webui/public/local
|
||||
@ -50,16 +48,15 @@ build-kairos-agent:
|
||||
ARG COMMIT=$(cat COMMIT)
|
||||
RUN --no-cache echo "Building Version: ${VERSION} and Commit: ${COMMIT}"
|
||||
ARG LDFLAGS="-s -w -X github.com/kairos-io/kairos-agent/v2/internal/common.VERSION=${VERSION} -X github.com/kairos-io/kairos-agent/v2/internal/common.gitCommit=$COMMIT"
|
||||
ENV CGO_ENABLED=${CGO_ENABLED}
|
||||
RUN go build -o kairos-agent -ldflags "${LDFLAGS}" main.go && upx kairos-agent
|
||||
ENV CGO_ENABLED=0
|
||||
RUN go build -o kairos-agent -ldflags "${LDFLAGS}" main.go
|
||||
SAVE ARTIFACT kairos-agent kairos-agent AS LOCAL build/kairos-agent
|
||||
|
||||
build:
|
||||
BUILD +build-kairos-agent
|
||||
|
||||
golint:
|
||||
ARG GO_VERSION
|
||||
FROM golang:$GO_VERSION
|
||||
FROM +go-deps
|
||||
ARG GOLINT_VERSION
|
||||
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$GOLINT_VERSION
|
||||
WORKDIR /build
|
||||
|
Loading…
Reference in New Issue
Block a user