Skip to content

Commit b3d176c

Browse files
authored
Merge branch 'main' into stepacton-enumparam-example
2 parents fc4c668 + 23b3dee commit b3d176c

File tree

170 files changed

+35299
-2965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+35299
-2965
lines changed

.github/workflows/ci.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ jobs:
4343
fi
4444
echo "$gofmt_out"
4545
- name: golangci-lint
46-
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
46+
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
4747
with:
48-
version: v1.62.2
48+
version: v1.64.6
49+
only-new-issues: true
4950
args: --timeout=10m
5051
- name: yamllint
5152
run: |

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ jobs:
6262

6363
# Initializes the CodeQL tools for scanning.
6464
- name: Initialize CodeQL
65-
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
65+
uses: github/codeql-action/init@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
6666
with:
6767
languages: ${{ matrix.language }}
6868
# If you wish to specify custom queries, you can do so here or in a config file.
6969
# By default, queries listed here will override any specified in a config file.
7070
# Prefix the list here with "+" to use these queries and those in the config file.
7171
# queries: ./path/to/local/query, your-org/your-repo/queries@main
7272

73-
- uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
73+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
7474
with:
7575
path: |
7676
~/.cache/go-build
@@ -96,4 +96,4 @@ jobs:
9696
make -j 4 all
9797
9898
- name: Perform CodeQL Analysis
99-
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
99+
uses: github/codeql-action/analyze@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11

.github/workflows/scorecard.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
persist-credentials: false
3939

4040
- name: "Run analysis"
41-
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
41+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
4242
with:
4343
results_file: results.sarif
4444
results_format: sarif
@@ -61,6 +61,6 @@ jobs:
6161

6262
# Upload the results to GitHub's code scanning dashboard.
6363
- name: "Upload to code-scanning"
64-
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
64+
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
6565
with:
6666
sarif_file: results.sarif

.github/workflows/woke.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
- name: Get changed files
2121
id: changed-files
22-
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
22+
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
2323
with:
2424
write_output_files: true
2525
files: |

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ repos:
1818
exclude: "(.*_test.go|^examples\/v1\/pipelineruns\/beta\/isolated-workspaces.yaml$)"
1919
- repo: local
2020
hooks:
21+
- id: lint-yaml
22+
name: "Lint YAML files"
23+
entry: bash -c 'yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print)'
24+
language: system
25+
types: [yaml]
2126
- id: lint-go
2227
name: "Run make golangci-lint"
2328
entry: make

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BIN = $(CURDIR)/.bin
1010
WOKE ?= go run -modfile go.mod github.com/get-woke/woke
1111

1212
# Get golangci_version from tools/go.mod
13-
GOLANGCI_VERSION := $(shell cat tools/go.mod | grep golangci-lint | awk '{ print $$3 }')
13+
GOLANGCI_VERSION := $(shell yq '.jobs.linting.steps[] | select(.name == "golangci-lint") | .with.version' .github/workflows/ci.yaml)
1414
WOKE_VERSION = v0.19.0
1515

1616
GO = go
@@ -168,11 +168,12 @@ errcheck: | $(ERRCHECK) ; $(info $(M) running errcheck…) ## Run errcheck
168168

169169
GOLANGCILINT = $(BIN)/golangci-lint-$(GOLANGCI_VERSION)
170170
$(BIN)/golangci-lint-$(GOLANGCI_VERSION): ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
171-
cd tools; go mod download github.com/golangci/golangci-lint && go mod tidy
172-
cd tools; go build -o $(BIN)/golangci-lint-$(GOLANGCI_VERSION) github.com/golangci/golangci-lint/cmd/golangci-lint
171+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN) $(GOLANGCI_VERSION)
172+
mv $(BIN)/golangci-lint $(BIN)/golangci-lint-$(GOLANGCI_VERSION)
173173

174174
.PHONY: golangci-lint
175175
golangci-lint: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint
176+
$Q $(GOLANGCILINT) config verify
176177
$Q $(GOLANGCILINT) run --modules-download-mode=vendor --max-issues-per-linter=0 --max-same-issues=0 --timeout 5m
177178

178179
.PHONY: golangci-lint-check

cmd/entrypoint/main.go

+2-13
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@ import (
2929
"time"
3030

3131
"github.com/tektoncd/pipeline/cmd/entrypoint/subcommands"
32-
featureFlags "github.com/tektoncd/pipeline/pkg/apis/config"
3332
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
3433
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
3534
"github.com/tektoncd/pipeline/pkg/credentials"
3635
"github.com/tektoncd/pipeline/pkg/credentials/dockercreds"
3736
"github.com/tektoncd/pipeline/pkg/credentials/gitcreds"
3837
"github.com/tektoncd/pipeline/pkg/entrypoint"
3938
"github.com/tektoncd/pipeline/pkg/platforms"
40-
"github.com/tektoncd/pipeline/pkg/spire"
41-
"github.com/tektoncd/pipeline/pkg/spire/config"
4239
"github.com/tektoncd/pipeline/pkg/termination"
4340
)
4441

@@ -59,9 +56,7 @@ var (
5956
onError = flag.String("on_error", "", "Set to \"continue\" to ignore an error and continue when a container terminates with a non-zero exit code."+
6057
" Set to \"stopAndFail\" to declare a failure with a step error and stop executing the rest of the steps.")
6158
stepMetadataDir = flag.String("step_metadata_dir", "", "If specified, create directory to store the step metadata e.g. /tekton/steps/<step-name>/")
62-
enableSpire = flag.Bool("enable_spire", false, "If specified by configmap, this enables spire signing and verification")
63-
socketPath = flag.String("spire_socket_path", "unix:///spiffe-workload-api/spire-agent.sock", "Experimental: The SPIRE agent socket for SPIFFE workload API.")
64-
resultExtractionMethod = flag.String("result_from", featureFlags.ResultExtractionMethodTerminationMessage, "The method using which to extract results from tasks. Default is using the termination message.")
59+
resultExtractionMethod = flag.String("result_from", entrypoint.ResultExtractionMethodTerminationMessage, "The method using which to extract results from tasks. Default is using the termination message.")
6560
)
6661

6762
const (
@@ -131,13 +126,7 @@ func main() {
131126
}
132127
}
133128

134-
var spireWorkloadAPI spire.EntrypointerAPIClient
135-
if enableSpire != nil && *enableSpire && socketPath != nil && *socketPath != "" {
136-
spireConfig := config.SpireConfig{
137-
SocketPath: *socketPath,
138-
}
139-
spireWorkloadAPI = spire.NewEntrypointerAPIClient(&spireConfig)
140-
}
129+
spireWorkloadAPI := initializeSpireAPI()
141130

142131
e := entrypoint.Entrypointer{
143132
Command: append(cmd, commandArgs...),

cmd/entrypoint/runner_test.go

+3-15
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ func TestRealRunnerSignalForwarding(t *testing.T) {
4949
}
5050

5151
func TestRealRunnerStdoutAndStderrPaths(t *testing.T) {
52-
tmp, err := os.MkdirTemp("", "")
53-
if err != nil {
54-
t.Fatalf("Unexpected error: %v", err)
55-
}
56-
defer os.RemoveAll(tmp)
52+
tmp := t.TempDir()
5753

5854
expectedString := "hello world"
5955
rr := realRunner{
@@ -112,11 +108,7 @@ func TestRealRunnerStdoutAndStderrPaths(t *testing.T) {
112108
}
113109

114110
func TestRealRunnerStdoutAndStderrSamePath(t *testing.T) {
115-
tmp, err := os.MkdirTemp("", "")
116-
if err != nil {
117-
t.Fatalf("Unexpected error: %v", err)
118-
}
119-
defer os.RemoveAll(tmp)
111+
tmp := t.TempDir()
120112

121113
path := filepath.Join(tmp, "logs")
122114
expectedString := "hello world"
@@ -138,11 +130,7 @@ func TestRealRunnerStdoutAndStderrSamePath(t *testing.T) {
138130
}
139131

140132
func TestRealRunnerStdoutPathWithSignal(t *testing.T) {
141-
tmp, err := os.MkdirTemp("", "")
142-
if err != nil {
143-
t.Fatalf("Unexpected error: %v", err)
144-
}
145-
defer os.RemoveAll(tmp)
133+
tmp := t.TempDir()
146134

147135
path := filepath.Join(tmp, "stdout")
148136
rr := realRunner{

cmd/entrypoint/spire.go

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//go:build !disable_spire
2+
3+
/*
4+
Copyright 2025 The Tekton Authors
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package main
20+
21+
import (
22+
"flag"
23+
"log"
24+
25+
"github.com/tektoncd/pipeline/pkg/spire"
26+
"github.com/tektoncd/pipeline/pkg/spire/config"
27+
)
28+
29+
var (
30+
enableSpire = flag.Bool("enable_spire", false, "If specified by configmap, this enables spire signing and verification")
31+
socketPath = flag.String("spire_socket_path", "unix:///spiffe-workload-api/spire-agent.sock", "Experimental: The SPIRE agent socket for SPIFFE workload API.")
32+
)
33+
34+
func initializeSpireAPI() spire.EntrypointerAPIClient {
35+
if enableSpire != nil && *enableSpire && socketPath != nil && *socketPath != "" {
36+
log.Println("SPIRE is enabled in this build, enableSpire is supported")
37+
spireConfig := config.SpireConfig{
38+
SocketPath: *socketPath,
39+
}
40+
return spire.NewEntrypointerAPIClient(&spireConfig)
41+
}
42+
return nil
43+
}

cmd/entrypoint/spire_disable.go

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//go:build disable_spire
2+
3+
/*
4+
Copyright 2025 The Tekton Authors
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package main
20+
21+
import (
22+
"context"
23+
"flag"
24+
"log"
25+
"os"
26+
27+
"github.com/tektoncd/pipeline/pkg/result"
28+
)
29+
30+
var (
31+
enableSpire = flag.Bool("enable_spire", false, "If specified by configmap, this enables spire signing and verification")
32+
)
33+
34+
// EntrypointerAPIClient interface maps to the spire entrypointer API to interact with spire
35+
type EntrypointerAPIClient interface {
36+
Close() error
37+
// Sign returns the signature material to be put in the RunResult to append to the output results
38+
Sign(ctx context.Context, results []result.RunResult) ([]result.RunResult, error)
39+
}
40+
41+
func initializeSpireAPI() EntrypointerAPIClient {
42+
if enableSpire != nil && *enableSpire {
43+
log.Fatal("Error: SPIRE is disabled in this build, but enableSpire was set to true. Please recompile with SPIRE support.")
44+
os.Exit(1)
45+
}
46+
return nil
47+
}

cmd/entrypoint/subcommands/decode_script_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func TestDecodeScript(t *testing.T) {
3030
decoded := `#!/usr/bin/env sh
3131
echo "Hello World!"
3232
`
33-
mode := os.FileMode(0600)
34-
expectedPermissions := os.FileMode(0600)
33+
mode := os.FileMode(0o600)
34+
expectedPermissions := os.FileMode(0o600)
3535

3636
tmp := t.TempDir()
3737
src := filepath.Join(tmp, "script.txt")
@@ -84,7 +84,7 @@ func TestDecodeScriptInvalidBase64(t *testing.T) {
8484
invalidData := []byte("!")
8585
expectedError := base64.CorruptInputError(0)
8686

87-
src, err := os.CreateTemp("", "decode-script-test-*")
87+
src, err := os.CreateTemp(t.TempDir(), "decode-script-test-*")
8888
if err != nil {
8989
t.Fatalf("error creating temp file: %v", err)
9090
}

0 commit comments

Comments
 (0)