From 5601fb0e136fad09282705ef65cbc9b2c6f0bebf Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Sun, 18 Feb 2024 04:53:22 +0100 Subject: [PATCH 01/10] refactor: simpilfy go-git cache (#2208) --- pkg/runner/action_cache.go | 35 ++-------------- pkg/runner/action_cache_test.go | 72 +++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 48 deletions(-) diff --git a/pkg/runner/action_cache.go b/pkg/runner/action_cache.go index da4e651c..1099d78f 100644 --- a/pkg/runner/action_cache.go +++ b/pkg/runner/action_cache.go @@ -6,7 +6,6 @@ import ( "crypto/rand" "encoding/hex" "errors" - "fmt" "io" "io/fs" "path" @@ -43,17 +42,7 @@ func (c GoGitActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token s return "", err } branchName := hex.EncodeToString(tmpBranch) - var refSpec config.RefSpec - spec := config.RefSpec(ref + ":" + branchName) - tagOrSha := false - if spec.IsExactSHA1() { - refSpec = spec - } else if strings.HasPrefix(ref, "refs/") { - refSpec = config.RefSpec(ref + ":refs/heads/" + branchName) - } else { - tagOrSha = true - refSpec = config.RefSpec("refs/*/" + ref + ":refs/heads/*/" + branchName) - } + var auth transport.AuthMethod if token != "" { auth = &http.BasicAuth{ @@ -71,35 +60,17 @@ func (c GoGitActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token s return "", err } defer func() { - if refs, err := gogitrepo.References(); err == nil { - _ = refs.ForEach(func(r *plumbing.Reference) error { - if strings.Contains(r.Name().String(), branchName) { - return gogitrepo.DeleteBranch(r.Name().String()) - } - return nil - }) - } + _ = gogitrepo.DeleteBranch(branchName) }() if err := remote.FetchContext(ctx, &git.FetchOptions{ RefSpecs: []config.RefSpec{ - refSpec, + config.RefSpec(ref + ":" + branchName), }, Auth: auth, Force: true, }); err != nil { - if tagOrSha && errors.Is(err, git.NoErrAlreadyUpToDate) { - return "", fmt.Errorf("couldn't find remote ref \"%s\"", ref) - } return "", err } - if tagOrSha { - for _, prefix := range []string{"refs/heads/tags/", "refs/heads/heads/"} { - hash, err := gogitrepo.ResolveRevision(plumbing.Revision(prefix + branchName)) - if err == nil { - return hash.String(), nil - } - } - } hash, err := gogitrepo.ResolveRevision(plumbing.Revision(branchName)) if err != nil { return "", err diff --git a/pkg/runner/action_cache_test.go b/pkg/runner/action_cache_test.go index e222cfb9..58fac5bd 100644 --- a/pkg/runner/action_cache_test.go +++ b/pkg/runner/action_cache_test.go @@ -18,20 +18,60 @@ func TestActionCache(t *testing.T) { Path: os.TempDir(), } ctx := context.Background() - sha, err := cache.Fetch(ctx, "christopherhx/script", "https://github.com/christopherhx/script", "main", "") - a.NoError(err) - a.NotEmpty(sha) - atar, err := cache.GetTarArchive(ctx, "christopherhx/script", sha, "node_modules") - a.NoError(err) - a.NotEmpty(atar) - mytar := tar.NewReader(atar) - th, err := mytar.Next() - a.NoError(err) - a.NotEqual(0, th.Size) - buf := &bytes.Buffer{} - // G110: Potential DoS vulnerability via decompression bomb (gosec) - _, err = io.Copy(buf, mytar) - a.NoError(err) - str := buf.String() - a.NotEmpty(str) + cacheDir := "nektos/act-test-actions" + repo := "https://github.com/nektos/act-test-actions" + refs := []struct { + Name string + CacheDir string + Repo string + Ref string + }{ + { + Name: "Fetch Branch Name", + CacheDir: cacheDir, + Repo: repo, + Ref: "main", + }, + { + Name: "Fetch Branch Name Absolutely", + CacheDir: cacheDir, + Repo: repo, + Ref: "refs/heads/main", + }, + { + Name: "Fetch HEAD", + CacheDir: cacheDir, + Repo: repo, + Ref: "HEAD", + }, + { + Name: "Fetch Sha", + CacheDir: cacheDir, + Repo: repo, + Ref: "de984ca37e4df4cb9fd9256435a3b82c4a2662b1", + }, + } + for _, c := range refs { + t.Run(c.Name, func(t *testing.T) { + sha, err := cache.Fetch(ctx, c.CacheDir, c.Repo, c.Ref, "") + if !a.NoError(err) || !a.NotEmpty(sha) { + return + } + atar, err := cache.GetTarArchive(ctx, c.CacheDir, sha, "js") + if !a.NoError(err) || !a.NotEmpty(atar) { + return + } + mytar := tar.NewReader(atar) + th, err := mytar.Next() + if !a.NoError(err) || !a.NotEqual(0, th.Size) { + return + } + buf := &bytes.Buffer{} + // G110: Potential DoS vulnerability via decompression bomb (gosec) + _, err = io.Copy(buf, mytar) + a.NoError(err) + str := buf.String() + a.NotEmpty(str) + }) + } } From 9e6ce121bc1f41e1ecb2c3db7b35f79af70d4ae2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 03:04:51 +0000 Subject: [PATCH 02/10] build(deps): bump github.com/opencontainers/image-spec (#2223) Bumps [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) from 1.1.0-rc6 to 1.1.0. - [Release notes](https://github.com/opencontainers/image-spec/releases) - [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md) - [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0-rc6...v1.1.0) --- updated-dependencies: - dependency-name: github.com/opencontainers/image-spec dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 86493ddb..28b192aa 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/moby/buildkit v0.12.5 github.com/moby/patternmatcher v0.6.0 - github.com/opencontainers/image-spec v1.1.0-rc6 + github.com/opencontainers/image-spec v1.1.0 github.com/opencontainers/selinux v1.11.0 github.com/pkg/errors v0.9.1 github.com/rhysd/actionlint v1.6.26 diff --git a/go.sum b/go.sum index 39d72cfb..8fb2a36b 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= -github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= From ac6a465e27dccae89e3fb98de355ae79f00f2d6e Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Fri, 23 Feb 2024 08:40:14 +0100 Subject: [PATCH 03/10] feat: Test writing remote Actions locally (#2155) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- cmd/input.go | 1 + cmd/root.go | 15 ++- pkg/runner/local_repository_cache.go | 91 +++++++++++++++++++ pkg/runner/runner_test.go | 26 ++++++ .../local-remote-action-overrides/config.yml | 3 + .../local-remote-action-overrides/push.yml | 9 ++ 6 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 pkg/runner/local_repository_cache.go create mode 100644 pkg/runner/testdata/local-remote-action-overrides/config.yml create mode 100644 pkg/runner/testdata/local-remote-action-overrides/push.yml diff --git a/cmd/input.go b/cmd/input.go index 36af6d86..59c14002 100644 --- a/cmd/input.go +++ b/cmd/input.go @@ -59,6 +59,7 @@ type Input struct { logPrefixJobID bool networkName string useNewActionCache bool + localRepository []string } func (i *Input) resolve(path string) string { diff --git a/cmd/root.go b/cmd/root.go index 9a4b5ffb..3eca0406 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -100,6 +100,7 @@ func Execute(ctx context.Context, version string) { rootCmd.PersistentFlags().BoolVarP(&input.actionOfflineMode, "action-offline-mode", "", false, "If action contents exists, it will not be fetch and pull again. If turn on this,will turn off force pull") rootCmd.PersistentFlags().StringVarP(&input.networkName, "network", "", "host", "Sets a docker network name. Defaults to host.") rootCmd.PersistentFlags().BoolVarP(&input.useNewActionCache, "use-new-action-cache", "", false, "Enable using the new Action Cache for storing Actions locally") + rootCmd.PersistentFlags().StringArrayVarP(&input.localRepository, "local-repository", "", []string{}, "Replaces the specified repository and ref with a local folder (e.g. https://github.com/test/test@v0=/home/act/test or test/test@v0=/home/act/test, the latter matches any hosts or protocols)") rootCmd.SetArgs(args()) if err := rootCmd.Execute(); err != nil { @@ -561,7 +562,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str Matrix: matrixes, ContainerNetworkMode: docker_container.NetworkMode(input.networkName), } - if input.useNewActionCache { + if input.useNewActionCache || len(input.localRepository) > 0 { if input.actionOfflineMode { config.ActionCache = &runner.GoGitActionCacheOfflineMode{ Parent: runner.GoGitActionCache{ @@ -573,6 +574,18 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str Path: config.ActionCacheDir, } } + if len(input.localRepository) > 0 { + localRepositories := map[string]string{} + for _, l := range input.localRepository { + k, v, _ := strings.Cut(l, "=") + localRepositories[k] = v + } + config.ActionCache = &runner.LocalRepositoryCache{ + Parent: config.ActionCache, + LocalRepositories: localRepositories, + CacheDirCache: map[string]string{}, + } + } } r, err := runner.New(config) if err != nil { diff --git a/pkg/runner/local_repository_cache.go b/pkg/runner/local_repository_cache.go new file mode 100644 index 00000000..b59ad34e --- /dev/null +++ b/pkg/runner/local_repository_cache.go @@ -0,0 +1,91 @@ +package runner + +import ( + "archive/tar" + "bytes" + "context" + "fmt" + "io" + "io/fs" + goURL "net/url" + "os" + "path/filepath" + "strings" + + "github.com/nektos/act/pkg/filecollector" +) + +type LocalRepositoryCache struct { + Parent ActionCache + LocalRepositories map[string]string + CacheDirCache map[string]string +} + +func (l *LocalRepositoryCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) { + if dest, ok := l.LocalRepositories[fmt.Sprintf("%s@%s", url, ref)]; ok { + l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, ref)] = dest + return ref, nil + } + if purl, err := goURL.Parse(url); err == nil { + if dest, ok := l.LocalRepositories[fmt.Sprintf("%s@%s", strings.TrimPrefix(purl.Path, "/"), ref)]; ok { + l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, ref)] = dest + return ref, nil + } + } + return l.Parent.Fetch(ctx, cacheDir, url, ref, token) +} + +func (l *LocalRepositoryCache) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error) { + // sha is mapped to ref in fetch if there is a local override + if dest, ok := l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, sha)]; ok { + srcPath := filepath.Join(dest, includePrefix) + buf := &bytes.Buffer{} + tw := tar.NewWriter(buf) + defer tw.Close() + srcPath = filepath.Clean(srcPath) + fi, err := os.Lstat(srcPath) + if err != nil { + return nil, err + } + tc := &filecollector.TarCollector{ + TarWriter: tw, + } + if fi.IsDir() { + srcPrefix := srcPath + if !strings.HasSuffix(srcPrefix, string(filepath.Separator)) { + srcPrefix += string(filepath.Separator) + } + fc := &filecollector.FileCollector{ + Fs: &filecollector.DefaultFs{}, + SrcPath: srcPath, + SrcPrefix: srcPrefix, + Handler: tc, + } + err = filepath.Walk(srcPath, fc.CollectFiles(ctx, []string{})) + if err != nil { + return nil, err + } + } else { + var f io.ReadCloser + var linkname string + if fi.Mode()&fs.ModeSymlink != 0 { + linkname, err = os.Readlink(srcPath) + if err != nil { + return nil, err + } + } else { + f, err = os.Open(srcPath) + if err != nil { + return nil, err + } + defer f.Close() + } + err := tc.WriteFile(fi.Name(), fi, linkname, f) + if err != nil { + return nil, err + } + } + return io.NopCloser(buf), nil + } + return l.Parent.GetTarArchive(ctx, cacheDir, sha, includePrefix) +} diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go index 96738a88..4dc01e15 100644 --- a/pkg/runner/runner_test.go +++ b/pkg/runner/runner_test.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "path" "path/filepath" "runtime" "strings" @@ -14,6 +15,7 @@ import ( "github.com/joho/godotenv" log "github.com/sirupsen/logrus" assert "github.com/stretchr/testify/assert" + "gopkg.in/yaml.v3" "github.com/nektos/act/pkg/common" "github.com/nektos/act/pkg/model" @@ -187,6 +189,7 @@ func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config GitHubInstance: "github.com", ContainerArchitecture: cfg.ContainerArchitecture, Matrix: cfg.Matrix, + ActionCache: cfg.ActionCache, } runner, err := New(runnerConfig) @@ -209,6 +212,10 @@ func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config fmt.Println("::endgroup::") } +type TestConfig struct { + LocalRepositories map[string]string `yaml:"local-repositories"` +} + func TestRunEvent(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") @@ -307,6 +314,9 @@ func TestRunEvent(t *testing.T) { {workdir, "services", "push", "", platforms, secrets}, {workdir, "services-host-network", "push", "", platforms, secrets}, {workdir, "services-with-container", "push", "", platforms, secrets}, + + // local remote action overrides + {workdir, "local-remote-action-overrides", "push", "", platforms, secrets}, } for _, table := range tables { @@ -320,6 +330,22 @@ func TestRunEvent(t *testing.T) { config.EventPath = eventFile } + testConfigFile := filepath.Join(workdir, table.workflowPath, "config.yml") + if file, err := os.ReadFile(testConfigFile); err == nil { + testConfig := &TestConfig{} + if yaml.Unmarshal(file, testConfig) == nil { + if testConfig.LocalRepositories != nil { + config.ActionCache = &LocalRepositoryCache{ + Parent: GoGitActionCache{ + path.Clean(path.Join(workdir, "cache")), + }, + LocalRepositories: testConfig.LocalRepositories, + CacheDirCache: map[string]string{}, + } + } + } + } + table.runTest(ctx, t, config) }) } diff --git a/pkg/runner/testdata/local-remote-action-overrides/config.yml b/pkg/runner/testdata/local-remote-action-overrides/config.yml new file mode 100644 index 00000000..ecabeb5d --- /dev/null +++ b/pkg/runner/testdata/local-remote-action-overrides/config.yml @@ -0,0 +1,3 @@ +local-repositories: + https://github.com/nektos/test-override@a: testdata/actions/node20 + nektos/test-override@b: testdata/actions/node16 \ No newline at end of file diff --git a/pkg/runner/testdata/local-remote-action-overrides/push.yml b/pkg/runner/testdata/local-remote-action-overrides/push.yml new file mode 100644 index 00000000..9482438f --- /dev/null +++ b/pkg/runner/testdata/local-remote-action-overrides/push.yml @@ -0,0 +1,9 @@ +name: basic +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: nektos/test-override@a + - uses: nektos/test-override@b \ No newline at end of file From e1cd7c915f79120d77bdee6f9ec11eadb2da25bf Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Sat, 24 Feb 2024 03:47:55 +0100 Subject: [PATCH 04/10] fix: logo and demo asset urls (#2226) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a038146..a04c43b8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![act-logo](https://github.com/nektos/act/wiki/img/logo-150.png) +![act-logo](https://raw.githubusercontent.com/wiki/nektos/act/img/logo-150.png) # Overview [![push](https://github.com/nektos/act/workflows/push/badge.svg?branch=master&event=push)](https://github.com/nektos/act/actions) [![Join the chat at https://gitter.im/nektos/act](https://badges.gitter.im/nektos/act.svg)](https://gitter.im/nektos/act?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/nektos/act)](https://goreportcard.com/report/github.com/nektos/act) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners) @@ -15,7 +15,7 @@ When you run `act` it reads in your GitHub Actions from `.github/workflows/` and Let's see it in action with a [sample repo](https://github.com/cplee/github-actions-demo)! -![Demo](https://github.com/nektos/act/wiki/quickstart/act-quickstart-2.gif) +![Demo](https://raw.githubusercontent.com/wiki/nektos/act/quickstart/act-quickstart-2.gif) # Act User Guide From 68597d68f6cc3c384bfd458ab4ec6d51f63a23f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 03:02:49 +0000 Subject: [PATCH 05/10] build(deps): bump github.com/rhysd/actionlint from 1.6.26 to 1.6.27 (#2228) Bumps [github.com/rhysd/actionlint](https://github.com/rhysd/actionlint) from 1.6.26 to 1.6.27. - [Release notes](https://github.com/rhysd/actionlint/releases) - [Changelog](https://github.com/rhysd/actionlint/blob/main/CHANGELOG.md) - [Commits](https://github.com/rhysd/actionlint/compare/v1.6.26...v1.6.27) --- updated-dependencies: - dependency-name: github.com/rhysd/actionlint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 28b192aa..0d68dba3 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/opencontainers/image-spec v1.1.0 github.com/opencontainers/selinux v1.11.0 github.com/pkg/errors v0.9.1 - github.com/rhysd/actionlint v1.6.26 + github.com/rhysd/actionlint v1.6.27 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 @@ -49,7 +49,7 @@ require ( github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -69,7 +69,7 @@ require ( github.com/opencontainers/runc v1.1.12 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rivo/uniseg v0.4.4 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/skeema/knownhosts v1.2.1 // indirect @@ -81,7 +81,7 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.13.0 // indirect diff --git a/go.sum b/go.sum index 8fb2a36b..143e7984 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,8 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= @@ -137,11 +137,11 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rhysd/actionlint v1.6.26 h1:zi7jPZf3Ks14gCXYAAL47uBziyFlX7+Xwilqhexct9g= -github.com/rhysd/actionlint v1.6.26/go.mod h1:TIj1DlCgtYLOv5CH9wCK+WJTOr1qAdnFzkGi0IgSCO4= +github.com/rhysd/actionlint v1.6.27 h1:xxwe8YmveBcC8lydW6GoHMGmB6H/MTqUU60F2p10wjw= +github.com/rhysd/actionlint v1.6.27/go.mod h1:m2nFUjAnOrxCMXuOMz9evYBRCLUsMnKY2IJl/N5umbk= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= @@ -225,8 +225,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From c79f59f802673f00911bea93db15b83f5bf3507b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 03:18:59 +0000 Subject: [PATCH 06/10] build(deps): bump go.etcd.io/bbolt from 1.3.8 to 1.3.9 (#2229) Bumps [go.etcd.io/bbolt](https://github.com/etcd-io/bbolt) from 1.3.8 to 1.3.9. - [Release notes](https://github.com/etcd-io/bbolt/releases) - [Commits](https://github.com/etcd-io/bbolt/compare/v1.3.8...v1.3.9) --- updated-dependencies: - dependency-name: go.etcd.io/bbolt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0d68dba3..fd672e5f 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a - go.etcd.io/bbolt v1.3.8 + go.etcd.io/bbolt v1.3.9 golang.org/x/term v0.17.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 diff --git a/go.sum b/go.sum index 143e7984..3b0829dc 100644 --- a/go.sum +++ b/go.sum @@ -190,8 +190,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI= +go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= From d3c8664d3d6acb855ae5418f6d02930c98bf877e Mon Sep 17 00:00:00 2001 From: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 02:12:58 +0000 Subject: [PATCH 07/10] chore: bump VERSION to 0.2.60 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a1a52a82..84b554a0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.59 \ No newline at end of file +0.2.60 \ No newline at end of file From 934b13a7a126198019800e79fb2ae7fe57a1c2bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 03:08:44 +0000 Subject: [PATCH 08/10] build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#2235) Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index fd672e5f..7f82fe6a 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a go.etcd.io/bbolt v1.3.9 golang.org/x/term v0.17.0 @@ -73,7 +73,7 @@ require ( github.com/robfig/cron/v3 v3.0.1 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/skeema/knownhosts v1.2.1 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect diff --git a/go.sum b/go.sum index 3b0829dc..84b1b2ad 100644 --- a/go.sum +++ b/go.sum @@ -163,18 +163,15 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a h1:oIi7H/bwFUYKYhzKbHc+3MvHRWqhQwXVB4LweLMiVy0= github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a/go.mod h1:iSvujNDmpZ6eQX+bg/0X3lF7LEmZ8N77g2a/J/+Zt2U= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= From 75e4ad93f4c6ba51a7a64f12335dd0268dd7465a Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Tue, 5 Mar 2024 07:04:54 +0100 Subject: [PATCH 09/10] fix: docker buildx cache restore not working (#2236) * To take effect artifacts v4 pr is needed with adjusted claims --- pkg/artifactcache/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/artifactcache/handler.go b/pkg/artifactcache/handler.go index 3178260b..1f0a6f64 100644 --- a/pkg/artifactcache/handler.go +++ b/pkg/artifactcache/handler.go @@ -385,7 +385,7 @@ func (h *Handler) findCache(db *bolthold.Store, keys []string, version string) ( } stop := fmt.Errorf("stop") - for _, prefix := range keys[1:] { + for _, prefix := range keys { found := false prefixPattern := fmt.Sprintf("^%s", regexp.QuoteMeta(prefix)) re, err := regexp.Compile(prefixPattern) From 352ad41ad2b8a205b12442859280b0e938b7e4ab Mon Sep 17 00:00:00 2001 From: huajin tong <137764712+thirdkeyword@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:20:06 +0800 Subject: [PATCH 10/10] fix function name in comment (#2240) Signed-off-by: thirdkeyword --- pkg/model/workflow.go | 4 ++-- pkg/runner/expression.go | 2 +- pkg/runner/logger.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/model/workflow.go b/pkg/model/workflow.go index 11864540..7fbecd6c 100644 --- a/pkg/model/workflow.go +++ b/pkg/model/workflow.go @@ -343,7 +343,7 @@ func environment(yml yaml.Node) map[string]string { return env } -// Environments returns string-based key=value map for a job +// Environment returns string-based key=value map for a job func (j *Job) Environment() map[string]string { return environment(j.Env) } @@ -578,7 +578,7 @@ func (s *Step) String() string { return s.ID } -// Environments returns string-based key=value map for a step +// Environment returns string-based key=value map for a step func (s *Step) Environment() map[string]string { return environment(s.Env) } diff --git a/pkg/runner/expression.go b/pkg/runner/expression.go index 412d1c02..2e3152b0 100644 --- a/pkg/runner/expression.go +++ b/pkg/runner/expression.go @@ -106,7 +106,7 @@ func (rc *RunContext) NewExpressionEvaluatorWithEnv(ctx context.Context, env map //go:embed hashfiles/index.js var hashfiles string -// NewExpressionEvaluator creates a new evaluator +// NewStepExpressionEvaluator creates a new evaluator func (rc *RunContext) NewStepExpressionEvaluator(ctx context.Context, step step) ExpressionEvaluator { // todo: cleanup EvaluationEnvironment creation job := rc.Run.Job() diff --git a/pkg/runner/logger.go b/pkg/runner/logger.go index 5a98210b..a788f680 100644 --- a/pkg/runner/logger.go +++ b/pkg/runner/logger.go @@ -52,7 +52,7 @@ func Masks(ctx context.Context) *[]string { return &[]string{} } -// WithLogger adds a value to the context for the logger +// WithMasks adds a value to the context for the logger func WithMasks(ctx context.Context, masks *[]string) context.Context { return context.WithValue(ctx, masksContextKeyVal, masks) }