mirror of
https://github.com/siderolabs/kres.git
synced 2026-02-05 09:45:35 +01:00
chore: bump deps
- bump Go to 1.22 - bump golangci-lint to v1.56.0 (supports Go 1.22) - minor fixes Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||
#
|
||||
# Generated on 2021-10-06T11:42:19Z by kres b3f580e.
|
||||
# Generated on 2024-02-08T17:53:03Z by kres 82c99e7-dirty.
|
||||
|
||||
codecov:
|
||||
require_ci_to_pass: false
|
||||
@@ -9,7 +9,7 @@ coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: 10%
|
||||
target: 8%
|
||||
threshold: 0.5%
|
||||
base: auto
|
||||
if_ci_failed: success
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||
#
|
||||
# Generated on 2023-10-23T14:23:46Z by kres 47db1f8-dirty.
|
||||
# Generated on 2024-02-08T17:40:59Z by kres 0bff90e-dirty.
|
||||
|
||||
# options for analysis running
|
||||
run:
|
||||
@@ -153,6 +153,7 @@ linters:
|
||||
- inamedparam
|
||||
- testifylint # complains about our assert recorder and has a number of false positives for assert.Greater(t, thing, 1)
|
||||
- protogetter # complains about us using Value field on typed spec, instead of GetValue which has a different signature
|
||||
- perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
|
||||
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
|
||||
- interfacer
|
||||
- maligned
|
||||
|
||||
@@ -37,7 +37,7 @@ spec:
|
||||
---
|
||||
kind: service.CodeCov
|
||||
spec:
|
||||
targetThreshold: 10
|
||||
targetThreshold: 8
|
||||
---
|
||||
kind: common.Build
|
||||
spec:
|
||||
|
||||
8
Makefile
8
Makefile
@@ -1,6 +1,6 @@
|
||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||
#
|
||||
# Generated on 2024-02-02T15:47:02Z by kres cdedbc0-dirty.
|
||||
# Generated on 2024-02-08T11:37:56Z by kres e87aefd-dirty.
|
||||
|
||||
# common variables
|
||||
|
||||
@@ -19,9 +19,9 @@ GRPC_GO_VERSION ?= 1.3.0
|
||||
GRPC_GATEWAY_VERSION ?= 2.19.1
|
||||
VTPROTOBUF_VERSION ?= 0.6.0
|
||||
DEEPCOPY_VERSION ?= v0.5.5
|
||||
GOLANGCILINT_VERSION ?= v1.55.2
|
||||
GOLANGCILINT_VERSION ?= v1.56.0
|
||||
GOFUMPT_VERSION ?= v0.6.0
|
||||
GO_VERSION ?= 1.21.6
|
||||
GO_VERSION ?= 1.22.0
|
||||
GOIMPORTS_VERSION ?= v0.17.0
|
||||
GO_BUILDFLAGS ?=
|
||||
GO_LDFLAGS ?=
|
||||
@@ -65,7 +65,7 @@ COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
|
||||
COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
|
||||
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
|
||||
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
|
||||
TOOLCHAIN ?= docker.io/golang:1.21-alpine
|
||||
TOOLCHAIN ?= docker.io/golang:1.22-alpine
|
||||
|
||||
# help menu
|
||||
|
||||
|
||||
4
go.mod
4
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/siderolabs/kres
|
||||
|
||||
go 1.21.6
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
github.com/drone/drone-yaml v1.2.3
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/siderolabs/gen v0.4.7
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
golang.org/x/mod v0.14.0
|
||||
golang.org/x/mod v0.15.0
|
||||
golang.org/x/oauth2 v0.16.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
4
go.sum
4
go.sum
@@ -146,8 +146,8 @@ golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
|
||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
|
||||
@@ -78,7 +78,7 @@ func (provider *Provider) Load(obj any) error {
|
||||
}
|
||||
|
||||
typ := reflect.TypeOf(obj).Elem()
|
||||
kind := fmt.Sprintf("%s.%s", path.Base(typ.PkgPath()), typ.Name())
|
||||
kind := path.Base(typ.PkgPath()) + "." + typ.Name()
|
||||
|
||||
name := ""
|
||||
if namedObj, ok := obj.(named); ok {
|
||||
|
||||
@@ -48,13 +48,13 @@ const (
|
||||
GoImportsVersion = "v0.17.0"
|
||||
// GolangCIlintVersion is the version of golangci-lint.
|
||||
// renovate: datasource=go depName=github.com/golangci/golangci-lint
|
||||
GolangCIlintVersion = "v1.55.2"
|
||||
GolangCIlintVersion = "v1.56.0"
|
||||
// GolangContainerImageVersion is the default golang container image.
|
||||
// renovate: datasource=docker versioning=docker depName=golang
|
||||
GolangContainerImageVersion = "1.21-alpine"
|
||||
GolangContainerImageVersion = "1.22-alpine"
|
||||
// GoVersion is the version of Go.
|
||||
// renovate: datasource=github-tags extractVersion=^go(?<version>.*)$ depName=golang/go
|
||||
GoVersion = "1.21.6"
|
||||
GoVersion = "1.22.0"
|
||||
// GrpcGatewayVersion is the version of grpc-gateway.
|
||||
// renovate: datasource=go depName=github.com/grpc-ecosystem/grpc-gateway
|
||||
GrpcGatewayVersion = "v2.19.1"
|
||||
|
||||
@@ -7,6 +7,7 @@ package step
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/kballard/go-shellquote"
|
||||
@@ -48,14 +49,14 @@ func (step *RunStep) SecurityInsecure() *RunStep {
|
||||
|
||||
// Env sets up environment variables for the step.
|
||||
func (step *RunStep) Env(name, value string) *RunStep {
|
||||
step.env = append(step.env, fmt.Sprintf("%s=%s", name, value))
|
||||
step.env = append(step.env, name+"="+value)
|
||||
|
||||
return step
|
||||
}
|
||||
|
||||
// MountCache mounts cache at specified target path.
|
||||
func (step *RunStep) MountCache(target string) *RunStep {
|
||||
step.mounts = append(step.mounts, fmt.Sprintf("type=cache,target=%s", target))
|
||||
step.mounts = append(step.mounts, "type=cache,target="+target)
|
||||
|
||||
return step
|
||||
}
|
||||
@@ -75,7 +76,7 @@ func (step *RunStep) Generate(w io.Writer) error {
|
||||
env += " "
|
||||
}
|
||||
|
||||
mounts := append([]string(nil), step.mounts...)
|
||||
mounts := slices.Clone(step.mounts)
|
||||
for i := range mounts {
|
||||
mounts[i] = "--mount=" + mounts[i]
|
||||
}
|
||||
@@ -87,7 +88,7 @@ func (step *RunStep) Generate(w io.Writer) error {
|
||||
|
||||
script := step.script
|
||||
if script == "" {
|
||||
script = fmt.Sprintf("%s %s", step.command, shellquote.Join(step.args...))
|
||||
script = step.command + " " + shellquote.Join(step.args...)
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, "RUN %s%s%s%s\n", security, mount, env, script)
|
||||
|
||||
@@ -19,8 +19,7 @@ func (o *Output) appendService(originalService *yaml.Container, pipeline *yaml.P
|
||||
// perform a shallow copy of the step to avoid modifying the original
|
||||
spec := *originalService
|
||||
|
||||
spec.Volumes = slices.Clone(spec.Volumes)
|
||||
spec.Volumes = append(spec.Volumes, o.standardMounts...)
|
||||
spec.Volumes = slices.Concat(spec.Volumes, o.standardMounts)
|
||||
|
||||
pipeline.Services = append(pipeline.Services, &spec)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -33,7 +32,7 @@ type FileAdapter struct {
|
||||
}
|
||||
|
||||
// ErrSkip makes file adapter skip the file write.
|
||||
var ErrSkip = fmt.Errorf("skip file")
|
||||
var ErrSkip = errors.New("skip file")
|
||||
|
||||
// Generate implements outout.Writer.
|
||||
//
|
||||
|
||||
@@ -135,7 +135,7 @@ func NewOutput() *Output {
|
||||
},
|
||||
{
|
||||
Name: "Slack Notify",
|
||||
Uses: fmt.Sprintf("slackapi/slack-github-action@%s", config.SlackNotifyActionVersion),
|
||||
Uses: "slackapi/slack-github-action@" + config.SlackNotifyActionVersion,
|
||||
With: map[string]string{
|
||||
"channel-id": "proj-talos-maintainers",
|
||||
"payload": slackNotifyPayload,
|
||||
@@ -207,7 +207,7 @@ func CommonSteps() []*Step {
|
||||
return []*Step{
|
||||
{
|
||||
Name: "checkout",
|
||||
Uses: fmt.Sprintf("actions/checkout@%s", config.CheckOutActionVersion),
|
||||
Uses: "actions/checkout@" + config.CheckOutActionVersion,
|
||||
},
|
||||
{
|
||||
Name: "Unshallow",
|
||||
@@ -222,7 +222,7 @@ func DefaultSteps() []*Step {
|
||||
CommonSteps(),
|
||||
&Step{
|
||||
Name: "Set up Docker Buildx",
|
||||
Uses: fmt.Sprintf("docker/setup-buildx-action@%s", config.SetupBuildxActionVersion),
|
||||
Uses: "docker/setup-buildx-action@" + config.SetupBuildxActionVersion,
|
||||
With: map[string]string{
|
||||
"driver": "remote",
|
||||
"endpoint": "tcp://localhost:1234",
|
||||
@@ -238,7 +238,7 @@ func DefaultPkgsSteps() []*Step {
|
||||
CommonSteps(),
|
||||
&Step{
|
||||
Name: "Set up Docker Buildx",
|
||||
Uses: fmt.Sprintf("docker/setup-buildx-action@%s", config.SetupBuildxActionVersion),
|
||||
Uses: "docker/setup-buildx-action@" + config.SetupBuildxActionVersion,
|
||||
With: map[string]string{
|
||||
"driver": "remote",
|
||||
"endpoint": "tcp://localhost:1234",
|
||||
@@ -252,7 +252,7 @@ func DefaultPkgsSteps() []*Step {
|
||||
func DefaultServices() map[string]Service {
|
||||
return map[string]Service{
|
||||
"buildkitd": {
|
||||
Image: fmt.Sprintf("moby/buildkit:%s", config.BuildKitContainerVersion),
|
||||
Image: "moby/buildkit:" + config.BuildKitContainerVersion,
|
||||
Options: "--privileged",
|
||||
Ports: []string{"1234:1234"},
|
||||
Volumes: []string{
|
||||
|
||||
@@ -149,6 +149,7 @@ linters:
|
||||
- inamedparam
|
||||
- testifylint # complains about our assert recorder and has a number of false positives for assert.Greater(t, thing, 1)
|
||||
- protogetter # complains about us using Value field on typed spec, instead of GetValue which has a different signature
|
||||
- perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
|
||||
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
|
||||
- interfacer
|
||||
- maligned
|
||||
|
||||
@@ -59,7 +59,7 @@ func (target *Target) Generate(w io.Writer) error {
|
||||
|
||||
description := target.description
|
||||
if description != "" {
|
||||
description = fmt.Sprintf(" ## %s", description)
|
||||
description = " ## " + description
|
||||
}
|
||||
|
||||
depends := strings.Join(target.depends, " ")
|
||||
|
||||
@@ -31,7 +31,7 @@ Generated on %s by %s.
|
||||
}
|
||||
|
||||
if PreambleCreator == "" {
|
||||
PreambleCreator = fmt.Sprintf("%s %s", version.Name, version.Tag)
|
||||
PreambleCreator = version.Name + " " + version.Tag
|
||||
}
|
||||
|
||||
preambleStr := fmt.Sprintf(preamble, PreambleTimestamp.Format(time.RFC3339), PreambleCreator)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"slices"
|
||||
"text/template"
|
||||
|
||||
"github.com/siderolabs/kres/internal/output"
|
||||
@@ -144,7 +144,7 @@ func (o *Output) Filenames() []string {
|
||||
files[index] = name
|
||||
}
|
||||
|
||||
sort.Strings(files)
|
||||
slices.Sort(files)
|
||||
|
||||
return files
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
@@ -82,7 +83,7 @@ func (builder *builder) DetectGit() (bool, error) {
|
||||
}
|
||||
|
||||
if upstreamRemote == nil {
|
||||
return true, fmt.Errorf("neither 'origin' or 'upstream' remote found")
|
||||
return true, errors.New("neither 'origin' or 'upstream' remote found")
|
||||
}
|
||||
|
||||
for _, remoteURL := range upstreamRemote.Config().URLs {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -62,7 +63,7 @@ func (builder *builder) DetectGolang() (bool, error) {
|
||||
}
|
||||
|
||||
if len(builder.meta.GoSourceFiles) == 0 && len(builder.meta.GoDirectories) == 0 {
|
||||
return false, fmt.Errorf("no Go source files found")
|
||||
return false, errors.New("no Go source files found")
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -70,7 +69,7 @@ func (builder *builder) BuildJS() error {
|
||||
toolchain.AddInput(builder.commonInputs...)
|
||||
|
||||
// unit-tests
|
||||
unitTests := js.NewUnitTests(builder.meta, fmt.Sprintf("unit-tests-%s", name))
|
||||
unitTests := js.NewUnitTests(builder.meta, "unit-tests-"+name)
|
||||
unitTests.AddInput(toolchain)
|
||||
builder.targets = append(builder.targets, unitTests)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ func NewDocker(meta *meta.Options) *Docker {
|
||||
|
||||
meta: meta,
|
||||
|
||||
DockerImage: fmt.Sprintf("docker:%s", config.DindContainerImageVersion),
|
||||
DockerImage: "docker:" + config.DindContainerImageVersion,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/siderolabs/kres/internal/config"
|
||||
@@ -63,7 +64,7 @@ func (image *Image) CompileDrone(output *drone.Output) error {
|
||||
)
|
||||
|
||||
step := drone.MakeStep(image.Name()).
|
||||
Name(fmt.Sprintf("push-%s", image.ImageName)).
|
||||
Name("push-"+image.ImageName). //nolint:goconst
|
||||
Environment("PUSH", "true").
|
||||
ExceptPullRequest().
|
||||
DockerLogin().
|
||||
@@ -82,7 +83,7 @@ func (image *Image) CompileDrone(output *drone.Output) error {
|
||||
OnlyOnBranch(image.meta.MainBranch).
|
||||
ExceptPullRequest().
|
||||
DockerLogin().
|
||||
DependsOn(fmt.Sprintf("push-%s", image.ImageName))
|
||||
DependsOn("push-" + image.ImageName)
|
||||
|
||||
for k, v := range image.ExtraEnvironment {
|
||||
step.Environment(k, v)
|
||||
@@ -98,7 +99,7 @@ func (image *Image) CompileDrone(output *drone.Output) error {
|
||||
func (image *Image) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
loginStep := &ghworkflow.Step{
|
||||
Name: "Login to registry",
|
||||
Uses: fmt.Sprintf("docker/login-action@%s", config.LoginActionVersion),
|
||||
Uses: "docker/login-action@" + config.LoginActionVersion,
|
||||
With: map[string]string{
|
||||
"registry": "ghcr.io",
|
||||
"username": "${{ github.repository_owner }}",
|
||||
@@ -109,7 +110,7 @@ func (image *Image) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
loginStep.ExceptPullRequest()
|
||||
|
||||
pushStep := ghworkflow.MakeStep(image.Name()).
|
||||
SetName(fmt.Sprintf("push-%s", image.ImageName)).
|
||||
SetName("push-"+image.ImageName).
|
||||
SetEnv("PUSH", "true").
|
||||
ExceptPullRequest()
|
||||
|
||||
@@ -161,10 +162,10 @@ func (image *Image) CompileDockerfile(output *dockerfile.Output) error {
|
||||
if image.BaseImage == "scratch" {
|
||||
stage.From(image.BaseImage)
|
||||
} else {
|
||||
output.Stage(fmt.Sprintf("base-%s", image.Name())).
|
||||
output.Stage("base-" + image.Name()).
|
||||
From(image.BaseImage)
|
||||
|
||||
stage.From(fmt.Sprintf("base-%s", image.Name()))
|
||||
stage.From("base-" + image.Name())
|
||||
}
|
||||
|
||||
for _, command := range image.CustomCommands {
|
||||
@@ -173,7 +174,7 @@ func (image *Image) CompileDockerfile(output *dockerfile.Output) error {
|
||||
|
||||
inputs := dag.GatherMatchingInputs(image, dag.Implements[dockerfile.Compiler]())
|
||||
if len(inputs) == 0 {
|
||||
return fmt.Errorf("no inputs for Image block")
|
||||
return errors.New("no inputs for Image block")
|
||||
}
|
||||
|
||||
for _, addImage := range image.AdditionalImages {
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/siderolabs/kres/internal/config"
|
||||
"github.com/siderolabs/kres/internal/dag"
|
||||
"github.com/siderolabs/kres/internal/output/dockerfile"
|
||||
@@ -24,7 +22,7 @@ type InputImage struct {
|
||||
// CompileDockerfile implements dockerfile.Compiler.
|
||||
func (inputImage *InputImage) CompileDockerfile(output *dockerfile.Output) error {
|
||||
output.Stage(inputImage.Name()).
|
||||
From(fmt.Sprintf("%s:%s", inputImage.Image, inputImage.Version))
|
||||
From(inputImage.Image + ":" + inputImage.Version)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -32,7 +30,7 @@ func (inputImage *InputImage) CompileDockerfile(output *dockerfile.Output) error
|
||||
// NewFHS builds standard input image for FHS.
|
||||
func NewFHS(_ *meta.Options) *InputImage {
|
||||
return &InputImage{
|
||||
BaseNode: dag.NewBaseNode(fmt.Sprintf("image-%s", "fhs")),
|
||||
BaseNode: dag.NewBaseNode("image-fhs"),
|
||||
|
||||
Image: "ghcr.io/siderolabs/fhs",
|
||||
Version: config.PkgsVersion,
|
||||
@@ -42,7 +40,7 @@ func NewFHS(_ *meta.Options) *InputImage {
|
||||
// NewCACerts builds standard input image for ca-certificates.
|
||||
func NewCACerts(_ *meta.Options) *InputImage {
|
||||
return &InputImage{
|
||||
BaseNode: dag.NewBaseNode(fmt.Sprintf("image-%s", "ca-certificates")),
|
||||
BaseNode: dag.NewBaseNode("image-ca-certificates"),
|
||||
|
||||
Image: "ghcr.io/siderolabs/ca-certificates",
|
||||
Version: config.PkgsVersion,
|
||||
|
||||
@@ -96,7 +96,7 @@ func (release *Release) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
|
||||
releaseStep := &ghworkflow.Step{
|
||||
Name: "Release",
|
||||
Uses: fmt.Sprintf("crazy-max/ghaction-github-release@%s", config.ReleaseActionVersion),
|
||||
Uses: "crazy-max/ghaction-github-release@" + config.ReleaseActionVersion,
|
||||
With: releaseStepOptions,
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
"slices"
|
||||
|
||||
"github.com/google/go-github/v58/github"
|
||||
"github.com/siderolabs/gen/xslices"
|
||||
@@ -303,23 +303,13 @@ func (r *Repository) inviteBot(client *github.Client) error {
|
||||
}
|
||||
|
||||
func equalStringSlices(a, b []string) bool {
|
||||
a = append([]string(nil), a...)
|
||||
b = append([]string(nil), b...)
|
||||
a = slices.Clone(a)
|
||||
b = slices.Clone(b)
|
||||
|
||||
sort.Strings(a)
|
||||
sort.Strings(b)
|
||||
slices.Sort(a)
|
||||
slices.Sort(b)
|
||||
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
for i := range a {
|
||||
if a[i] != b[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
return slices.Equal(a, b)
|
||||
}
|
||||
|
||||
const mplHeader = `// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
|
||||
@@ -219,10 +219,7 @@ func (step *Step) CompileDrone(output *drone.Output) error {
|
||||
pipeline.Step(
|
||||
drone.CustomStep("load-artifacts",
|
||||
`az login --service-principal -u "$${AZURE_STORAGE_USER}" -p "$${AZURE_STORAGE_PASS}" --tenant "$${AZURE_TENANT}"`,
|
||||
fmt.Sprintf(
|
||||
`mkdir -p %s`,
|
||||
step.meta.ArtifactsPath,
|
||||
),
|
||||
`mkdir -p `+step.meta.ArtifactsPath,
|
||||
fmt.Sprintf(
|
||||
`az storage blob download-batch --overwrite true -d %s -s ${CI_COMMIT_SHA}${DRONE_TAG//./-}`,
|
||||
step.meta.ArtifactsPath,
|
||||
@@ -312,7 +309,7 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
&ghworkflow.Step{
|
||||
Name: "Retrieve PR labels",
|
||||
ID: "retrieve-pr-labels",
|
||||
Uses: fmt.Sprintf("actions/github-script@%s", config.GitHubScriptActionVersion),
|
||||
Uses: "actions/github-script@" + config.GitHubScriptActionVersion,
|
||||
With: map[string]string{
|
||||
"retries": "3",
|
||||
"script": strings.TrimPrefix(ghworkflow.IssueLabelRetrieveScript, "\n"),
|
||||
@@ -335,7 +332,7 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
},
|
||||
&ghworkflow.Step{
|
||||
Name: "save-artifacts",
|
||||
Uses: fmt.Sprintf("actions/upload-artifact@%s", config.UploadArtifactActionVersion),
|
||||
Uses: "actions/upload-artifact@" + config.UploadArtifactActionVersion, //nolint:goconst
|
||||
ContinueOnError: step.GHAction.Artifacts.ContinueOnError,
|
||||
With: map[string]string{
|
||||
"name": "artifacts",
|
||||
@@ -348,7 +345,7 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
for _, additionalArtifact := range step.GHAction.Artifacts.Additional {
|
||||
artifactStep := &ghworkflow.Step{
|
||||
Name: fmt.Sprintf("save-%s-artifacts", additionalArtifact.Name),
|
||||
Uses: fmt.Sprintf("actions/upload-artifact@%s", config.UploadArtifactActionVersion),
|
||||
Uses: "actions/upload-artifact@" + config.UploadArtifactActionVersion,
|
||||
ContinueOnError: step.GHAction.Artifacts.ContinueOnError,
|
||||
With: map[string]string{
|
||||
"name": additionalArtifact.Name,
|
||||
@@ -381,16 +378,16 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
return fmt.Sprintf("contains(fromJSON(needs.default.outputs.labels), '%s')", label)
|
||||
})
|
||||
|
||||
artifactSteps := []*ghworkflow.Step{}
|
||||
var artifactSteps []*ghworkflow.Step
|
||||
|
||||
if step.GHAction.Artifacts.Enabled {
|
||||
for _, additionalArtifact := range step.GHAction.Artifacts.Additional {
|
||||
artifactStep := &ghworkflow.Step{
|
||||
Name: fmt.Sprintf("save-%s-artifacts", additionalArtifact.Name),
|
||||
Uses: fmt.Sprintf("actions/upload-artifact@%s", config.UploadArtifactActionVersion),
|
||||
Uses: "actions/upload-artifact@" + config.UploadArtifactActionVersion,
|
||||
ContinueOnError: additionalArtifact.ContinueOnError,
|
||||
With: map[string]string{
|
||||
"name": fmt.Sprintf("%s-%s", additionalArtifact.Name, job.Name),
|
||||
"name": additionalArtifact.Name + "-" + job.Name,
|
||||
"path": strings.Join(additionalArtifact.Paths, "\n"),
|
||||
"retention-days": "5",
|
||||
},
|
||||
@@ -412,14 +409,14 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
Steps: ghworkflow.DefaultSteps(),
|
||||
})
|
||||
|
||||
steps := []*ghworkflow.Step{}
|
||||
var steps []*ghworkflow.Step
|
||||
|
||||
if step.GHAction.Artifacts.Enabled {
|
||||
steps = append(
|
||||
steps,
|
||||
&ghworkflow.Step{
|
||||
Name: "Download artifacts",
|
||||
Uses: fmt.Sprintf("actions/download-artifact@%s", config.DownloadArtifactActionVersion),
|
||||
Uses: "actions/download-artifact@" + config.DownloadArtifactActionVersion,
|
||||
With: map[string]string{
|
||||
"name": "artifacts",
|
||||
"path": step.meta.ArtifactsPath,
|
||||
@@ -455,7 +452,7 @@ func (step *Step) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
)
|
||||
|
||||
if len(job.Crons) > 0 {
|
||||
workflowName := fmt.Sprintf("%s-cron", job.Name)
|
||||
workflowName := job.Name + "-cron"
|
||||
|
||||
output.AddSlackNotify(workflowName)
|
||||
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/siderolabs/gen/maps"
|
||||
|
||||
"github.com/siderolabs/kres/internal/dag"
|
||||
"github.com/siderolabs/kres/internal/output/dockerfile"
|
||||
"github.com/siderolabs/kres/internal/output/dockerfile/step"
|
||||
@@ -42,13 +45,9 @@ type artifact struct {
|
||||
}
|
||||
|
||||
func (c CompileConfig) set(script *step.RunStep) {
|
||||
keys := make([]string, 0, len(c))
|
||||
keys := maps.Keys(c)
|
||||
|
||||
for key := range c {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
|
||||
sort.Strings(keys)
|
||||
slices.Sort(keys)
|
||||
|
||||
for _, key := range keys {
|
||||
script.Env(key, c[key])
|
||||
@@ -67,8 +66,8 @@ func NewBuild(meta *meta.Options, name, sourcePath string) *Build {
|
||||
// CompileDockerfile implements dockerfile.Compiler.
|
||||
func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
|
||||
addBuildSteps := func(name string, opts CompileConfig) {
|
||||
stage := output.Stage(fmt.Sprintf("%s-build", name)).
|
||||
Description(fmt.Sprintf("builds %s", name)).
|
||||
stage := output.Stage(name + "-build").
|
||||
Description("builds " + name).
|
||||
From("base").
|
||||
Step(step.Copy("/", "/").From("generate"))
|
||||
|
||||
@@ -89,7 +88,7 @@ func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
|
||||
Step(step.Arg("SHA")).
|
||||
Step(step.Arg("TAG"))
|
||||
|
||||
ldflags += fmt.Sprintf(" -X ${VERSION_PKG}.Name=%s", build.Name())
|
||||
ldflags += " -X ${VERSION_PKG}.Name=" + build.Name()
|
||||
ldflags += " -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}"
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
|
||||
|
||||
output.Stage(name).
|
||||
From("scratch").
|
||||
Step(step.Copy("/"+name, "/"+name).From(fmt.Sprintf("%s-build", name)))
|
||||
Step(step.Copy("/"+name, "/"+name).From(name + "-build"))
|
||||
}
|
||||
|
||||
for _, artifact := range build.getArtifacts() {
|
||||
@@ -119,14 +118,14 @@ func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
|
||||
}
|
||||
|
||||
// combine all binaries built for each arch into '-all' stage
|
||||
all := output.Stage(fmt.Sprintf("%s-all", build.Name())).
|
||||
all := output.Stage(build.Name() + "-all").
|
||||
From("scratch")
|
||||
|
||||
for _, artifact := range build.getArtifacts() {
|
||||
all.Step(step.Copy("/", "/").From(artifact.name))
|
||||
}
|
||||
|
||||
build.entrypoint = fmt.Sprintf("%s-linux-${TARGETARCH}", build.Name())
|
||||
build.entrypoint = build.Name() + "-linux-${TARGETARCH}"
|
||||
output.Stage(build.Name()).
|
||||
From(build.entrypoint)
|
||||
|
||||
@@ -156,7 +155,7 @@ func (build *Build) CompileMakefile(output *makefile.Output) error {
|
||||
deps := make([]string, 0, len(artifacts))
|
||||
|
||||
for _, artifact := range artifacts {
|
||||
output.Target(fmt.Sprintf("$(ARTIFACTS)/%s", artifact.name)).
|
||||
output.Target("$(ARTIFACTS)/" + artifact.name).
|
||||
Script(fmt.Sprintf("@$(MAKE) local-%s DEST=$(ARTIFACTS)", artifact.name)).
|
||||
Phony()
|
||||
|
||||
@@ -164,7 +163,7 @@ func (build *Build) CompileMakefile(output *makefile.Output) error {
|
||||
|
||||
output.Target(artifact.name).
|
||||
Description(fmt.Sprintf("Builds executable for %s.", artifact.name)).
|
||||
Depends(fmt.Sprintf("$(ARTIFACTS)/%s", artifact.name)).
|
||||
Depends("$(ARTIFACTS)/" + artifact.name).
|
||||
Phony()
|
||||
}
|
||||
|
||||
@@ -191,21 +190,19 @@ func (build *Build) getArtifacts() []artifact {
|
||||
if len(build.Outputs) == 0 {
|
||||
build.artifacts = []artifact{
|
||||
{
|
||||
name: fmt.Sprintf("%s-linux-amd64", build.Name()),
|
||||
name: build.Name() + "-linux-amd64",
|
||||
},
|
||||
}
|
||||
} else {
|
||||
build.artifacts = make([]artifact, 0, len(build.Outputs))
|
||||
|
||||
for name, config := range build.Outputs {
|
||||
build.artifacts = append(build.artifacts, artifact{
|
||||
build.artifacts = maps.ToSlice(build.Outputs, func(name string, config CompileConfig) artifact {
|
||||
return artifact{
|
||||
name: strings.Join([]string{build.Name(), name}, "-"),
|
||||
config: config,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
sort.Slice(build.artifacts, func(i, j int) bool {
|
||||
return build.artifacts[i].name < build.artifacts[j].name
|
||||
slices.SortFunc(build.artifacts, func(a, b artifact) int {
|
||||
return cmp.Compare(a.name, b.name)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -215,12 +215,12 @@ func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error {
|
||||
}
|
||||
|
||||
flags := []string{
|
||||
fmt.Sprintf("-I%s", generate.BaseSpecPath),
|
||||
"-I" + generate.BaseSpecPath,
|
||||
}
|
||||
|
||||
if spec.GenGateway {
|
||||
flags = append(flags,
|
||||
fmt.Sprintf("--grpc-gateway_out=paths=source_relative:%s", generate.BaseSpecPath),
|
||||
"--grpc-gateway_out=paths=source_relative:"+generate.BaseSpecPath,
|
||||
"--grpc-gateway_opt=generate_unbound_methods=true",
|
||||
)
|
||||
|
||||
@@ -233,13 +233,13 @@ func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error {
|
||||
|
||||
if !spec.GenGateway || !spec.external {
|
||||
flags = append(flags,
|
||||
fmt.Sprintf("--go_out=paths=source_relative:%s", generate.BaseSpecPath),
|
||||
fmt.Sprintf("--go-grpc_out=paths=source_relative:%s", generate.BaseSpecPath),
|
||||
"--go_out=paths=source_relative:"+generate.BaseSpecPath,
|
||||
"--go-grpc_out=paths=source_relative:"+generate.BaseSpecPath,
|
||||
)
|
||||
|
||||
if generate.VTProtobufEnabled {
|
||||
flags = append(flags,
|
||||
fmt.Sprintf("--go-vtproto_out=paths=source_relative:%s", generate.BaseSpecPath),
|
||||
"--go-vtproto_out=paths=source_relative:"+generate.BaseSpecPath,
|
||||
"--go-vtproto_opt=features=marshal+unmarshal+size+equal+clone",
|
||||
)
|
||||
}
|
||||
@@ -347,7 +347,7 @@ func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error {
|
||||
Step(step.Arg("ABBREV_TAG")).
|
||||
Step(step.Script(fmt.Sprintf(abbrevCommand, generate.versionPackagePath())))
|
||||
|
||||
src := fmt.Sprintf("/src/%s", generate.versionPackagePath())
|
||||
src := "/src/" + generate.versionPackagePath()
|
||||
|
||||
generateStage.Step(step.Copy(src, generate.versionPackagePath()).From("embed-abbrev-generate"))
|
||||
|
||||
@@ -363,7 +363,7 @@ func (generate *Generate) CompileTemplates(output *template.Output) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
output.Define(fmt.Sprintf("%s/version.go", generate.versionPackagePath()), templates.VersionGo).
|
||||
output.Define(generate.versionPackagePath()+"/version.go", templates.VersionGo).
|
||||
PreamblePrefix("// ").
|
||||
WithLicense().
|
||||
NoOverwrite()
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -85,9 +84,9 @@ func (toolchain *Toolchain) image() string {
|
||||
|
||||
switch toolchain.Kind {
|
||||
case ToolchainOfficial:
|
||||
return fmt.Sprintf("docker.io/golang:%s", toolchain.Version)
|
||||
return "docker.io/golang:" + toolchain.Version
|
||||
case ToolchainTools:
|
||||
return fmt.Sprintf("ghcr.io/siderolabs/tools:%s", toolchain.Version)
|
||||
return "ghcr.io/siderolabs/tools:" + toolchain.Version
|
||||
default:
|
||||
panic("unsupported toolchain kind")
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func (tests *UnitTests) CompileDockerfile(output *dockerfile.Output) error {
|
||||
}
|
||||
|
||||
workdir := step.WorkDir(filepath.Join("/src", tests.packagePath))
|
||||
testRun := fmt.Sprintf("%s-run", tests.Name())
|
||||
testRun := tests.Name() + "-run"
|
||||
|
||||
output.Stage(testRun).
|
||||
Description("runs unit-tests").
|
||||
@@ -77,7 +77,8 @@ func (tests *UnitTests) CompileDockerfile(output *dockerfile.Output) error {
|
||||
From("scratch").
|
||||
Step(step.Copy(filepath.Join("/src", tests.packagePath, "coverage.txt"), fmt.Sprintf("/coverage-%s.txt", tests.Name())).From(testRun))
|
||||
|
||||
output.Stage(fmt.Sprintf("%s-race", tests.Name())).
|
||||
//nolint:goconst
|
||||
output.Stage(tests.Name() + "-race").
|
||||
Description("runs unit-tests with race detector").
|
||||
From("base").
|
||||
Step(workdir).
|
||||
@@ -110,12 +111,12 @@ func (tests *UnitTests) CompileMakefile(output *makefile.Output) error {
|
||||
|
||||
output.Target(tests.Name()).
|
||||
Description("Performs unit tests").
|
||||
Script(fmt.Sprintf("@$(MAKE) local-$@ DEST=$(ARTIFACTS)%s", scriptExtraArgs)).
|
||||
Script("@$(MAKE) local-$@ DEST=$(ARTIFACTS)" + scriptExtraArgs).
|
||||
Phony()
|
||||
|
||||
output.Target(fmt.Sprintf("%s-race", tests.Name())).
|
||||
output.Target(tests.Name() + "-race").
|
||||
Description("Performs unit tests with race detection enabled.").
|
||||
Script(fmt.Sprintf("@$(MAKE) target-$@%s", scriptExtraArgs)).
|
||||
Script("@$(MAKE) target-$@" + scriptExtraArgs).
|
||||
Phony()
|
||||
|
||||
return nil
|
||||
@@ -127,7 +128,7 @@ func (tests *UnitTests) CompileDrone(output *drone.Output) error {
|
||||
DependsOn(dag.GatherMatchingInputNames(tests, dag.Implements[drone.Compiler]())...),
|
||||
)
|
||||
|
||||
output.Step(drone.MakeStep(fmt.Sprintf("%s-race", tests.Name())).
|
||||
output.Step(drone.MakeStep(fmt.Sprintf(tests.Name(), "-race")).
|
||||
DependsOn(dag.GatherMatchingInputNames(tests, dag.Implements[drone.Compiler]())...),
|
||||
)
|
||||
|
||||
@@ -139,7 +140,7 @@ func (tests *UnitTests) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
output.AddStep(
|
||||
"default",
|
||||
ghworkflow.MakeStep(tests.Name()),
|
||||
ghworkflow.MakeStep(fmt.Sprintf("%s-race", tests.Name())),
|
||||
ghworkflow.MakeStep(tests.Name()+"-race"),
|
||||
)
|
||||
|
||||
return nil
|
||||
|
||||
@@ -68,7 +68,7 @@ func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
|
||||
outputDir := fmt.Sprintf("/internal/%s/dist", build.Name())
|
||||
|
||||
output.Stage(build.Name()).
|
||||
Description(fmt.Sprintf("builds %s", build.Name())).
|
||||
Description("builds " + build.Name()).
|
||||
From("js").
|
||||
Step(step.Arg(nodeBuildArgsVarName)).
|
||||
Step(step.Script("npm run build ${" + nodeBuildArgsVarName + "}").
|
||||
@@ -101,7 +101,7 @@ func (build *Build) CompileMakefile(output *makefile.Output) error {
|
||||
Variable(makefile.OverridableVariable(nodeBuildArgsVarName, ""))
|
||||
|
||||
output.Target(fmt.Sprintf("$(ARTIFACTS)/%s-js", build.Name())).
|
||||
Script(fmt.Sprintf("@$(MAKE) target-%s", build.Name())).
|
||||
Script("@$(MAKE) target-" + build.Name()).
|
||||
Phony()
|
||||
|
||||
output.Target(build.Name()).
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package js
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -75,7 +74,8 @@ func (proto *Protobuf) CompileMakefile(output *makefile.Output) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
output.Target(fmt.Sprintf("generate-%s", proto.Name())).Description("Generate .proto definitions.").
|
||||
output.Target("generate-" + proto.Name()).
|
||||
Description("Generate .proto definitions.").
|
||||
Script("@$(MAKE) local-$@ DEST=./")
|
||||
|
||||
return nil
|
||||
@@ -101,9 +101,9 @@ func (proto *Protobuf) ToolchainBuild(stage *dockerfile.Stage) error {
|
||||
// CompileDockerfile implements dockerfile.Compiler.
|
||||
func (proto *Protobuf) CompileDockerfile(output *dockerfile.Output) error {
|
||||
rootDir := "/" + proto.Name()
|
||||
generateContainer := fmt.Sprintf("generate-%s", proto.Name())
|
||||
specsContainer := fmt.Sprintf("proto-specs-%s", proto.Name())
|
||||
compileContainer := fmt.Sprintf("proto-compile-%s", proto.Name())
|
||||
generateContainer := "generate-" + proto.Name()
|
||||
specsContainer := "proto-specs-" + proto.Name()
|
||||
compileContainer := "proto-compile-" + proto.Name()
|
||||
|
||||
generate := output.Stage(generateContainer).
|
||||
Description("cleaned up specs and compiled versions").
|
||||
@@ -149,11 +149,11 @@ func (proto *Protobuf) CompileDockerfile(output *dockerfile.Output) error {
|
||||
source := filepath.Join(dir, spec.SubDirectory, filepath.Base(spec.Source))
|
||||
|
||||
args := []string{
|
||||
fmt.Sprintf("-I%s", dir),
|
||||
"-I" + dir,
|
||||
}
|
||||
|
||||
args = append(args,
|
||||
fmt.Sprintf("--grpc-gateway-ts_out=source_relative:%s", dir),
|
||||
"--grpc-gateway-ts_out=source_relative:"+dir,
|
||||
"--grpc-gateway-ts_opt=use_proto_names=true",
|
||||
)
|
||||
args = append(args, proto.ExperimentalFlags...)
|
||||
@@ -168,7 +168,7 @@ func (proto *Protobuf) CompileDockerfile(output *dockerfile.Output) error {
|
||||
|
||||
if !strings.HasPrefix(spec.Source, "http") {
|
||||
cleanupSteps = append(cleanupSteps,
|
||||
step.Script(fmt.Sprintf("rm %s", source)),
|
||||
step.Script("rm "+source),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package js
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -80,7 +79,7 @@ func (toolchain *Toolchain) image() string {
|
||||
return toolchain.Image
|
||||
}
|
||||
|
||||
return fmt.Sprintf("docker.io/node:%s", toolchain.Version)
|
||||
return "docker.io/node:" + toolchain.Version
|
||||
}
|
||||
|
||||
// CompileMakefile implements makefile.Compiler.
|
||||
@@ -121,7 +120,7 @@ func (toolchain *Toolchain) CompileDockerfile(output *dockerfile.Output) error {
|
||||
output.Stage("js-toolchain").
|
||||
Description("base toolchain image").
|
||||
From("${JS_TOOLCHAIN}").
|
||||
Step(step.Copy("/usr/local/go", "/usr/local/go").From(fmt.Sprintf("golang:%s", toolchain.meta.GoContainerVersion))).
|
||||
Step(step.Copy("/usr/local/go", "/usr/local/go").From("golang:" + toolchain.meta.GoContainerVersion)).
|
||||
Step(step.Run("apk", "--update", "--no-cache", "add", "bash", "curl", "protoc", "protobuf-dev")).
|
||||
Step(step.Copy("./go.mod", ".")).
|
||||
Step(step.Copy("./go.sum", ".")).
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
package markdown
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/siderolabs/kres/internal/config"
|
||||
"github.com/siderolabs/kres/internal/dag"
|
||||
"github.com/siderolabs/kres/internal/output/dockerfile"
|
||||
@@ -45,10 +43,10 @@ func NewLint(meta *meta.Options) *Lint {
|
||||
// CompileDockerfile implements dockerfile.Compiler.
|
||||
func (lint *Lint) CompileDockerfile(output *dockerfile.Output) error {
|
||||
stage := output.Stage(lint.Name()).Description("runs markdownlint").
|
||||
From(fmt.Sprintf("docker.io/node:%s", lint.BaseImage)).
|
||||
From("docker.io/node:" + lint.BaseImage).
|
||||
Step(step.WorkDir("/src")).
|
||||
Step(step.Run("npm", "i", "-g", fmt.Sprintf("markdownlint-cli@%s", lint.MardownLintCLIVersion))).
|
||||
Step(step.Run("npm", "i", fmt.Sprintf("sentences-per-line@%s", lint.SentencesPerLineVersion))).
|
||||
Step(step.Run("npm", "i", "-g", "markdownlint-cli@"+lint.MardownLintCLIVersion)).
|
||||
Step(step.Run("npm", "i", "sentences-per-line@"+lint.SentencesPerLineVersion)).
|
||||
Step(step.Copy(".markdownlint.json", "."))
|
||||
|
||||
for _, directory := range lint.meta.MarkdownDirectories {
|
||||
|
||||
@@ -127,7 +127,7 @@ func (pkgfile *Build) CompileMakefile(output *makefile.Output) error {
|
||||
if pkgfile.ReproducibleTargetName != "" {
|
||||
output.Target("reproducibility-test").
|
||||
Description("Builds the reproducibility test target").
|
||||
Script(fmt.Sprintf("@$(MAKE) reproducibility-test-local-%s", pkgfile.ReproducibleTargetName))
|
||||
Script("@$(MAKE) reproducibility-test-local-" + pkgfile.ReproducibleTargetName)
|
||||
}
|
||||
|
||||
output.Target("reproducibility-test-local-%").
|
||||
@@ -144,7 +144,7 @@ func (pkgfile *Build) CompileMakefile(output *makefile.Output) error {
|
||||
defaultTarget := "$(TARGETS)"
|
||||
|
||||
for name, targets := range pkgfile.AdditionalTargets {
|
||||
targetName := fmt.Sprintf("%s_TARGETS", strings.ToUpper(name))
|
||||
targetName := strings.ToUpper(name) + "_TARGETS"
|
||||
targetNameVariable := fmt.Sprintf("$(%s)", targetName)
|
||||
defaultTarget += " " + targetNameVariable
|
||||
|
||||
@@ -187,7 +187,7 @@ func (pkgfile *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
|
||||
loginStep := &ghworkflow.Step{
|
||||
Name: "Login to registry",
|
||||
Uses: fmt.Sprintf("docker/login-action@%s", config.LoginActionVersion),
|
||||
Uses: "docker/login-action@" + config.LoginActionVersion,
|
||||
With: map[string]string{
|
||||
"registry": "ghcr.io",
|
||||
"username": "${{ github.repository_owner }}",
|
||||
@@ -214,13 +214,13 @@ func (pkgfile *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
for name := range pkgfile.AdditionalTargets {
|
||||
output.AddStep(
|
||||
"default",
|
||||
ghworkflow.MakeStep(name).SetName(fmt.Sprintf("Build %s", name)),
|
||||
ghworkflow.MakeStep(name).SetName("Build "+name),
|
||||
)
|
||||
|
||||
steps = append(
|
||||
steps,
|
||||
ghworkflow.MakeStep(name, "PUSH=true").
|
||||
SetName(fmt.Sprintf("Push %s", name)).
|
||||
SetName("Push "+name).
|
||||
ExceptPullRequest(),
|
||||
)
|
||||
}
|
||||
@@ -233,7 +233,7 @@ func (pkgfile *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error {
|
||||
&ghworkflow.Step{
|
||||
Name: "Retrieve PR labels",
|
||||
ID: "retrieve-pr-labels",
|
||||
Uses: fmt.Sprintf("actions/github-script@%s", config.GitHubScriptActionVersion),
|
||||
Uses: "actions/github-script@" + config.GitHubScriptActionVersion,
|
||||
With: map[string]string{
|
||||
"retries": "3",
|
||||
"script": strings.TrimPrefix(ghworkflow.IssueLabelRetrieveScript, "\n"),
|
||||
|
||||
Reference in New Issue
Block a user