fix(context): clean up context usage BE-12766 (#2164)

This commit is contained in:
andres-portainer
2026-04-01 18:02:48 -03:00
committed by GitHub
parent e68e14787b
commit 50056bef70
91 changed files with 558 additions and 519 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
package stackutils
import (
"context"
"fmt"
"github.com/pkg/errors"
@@ -16,7 +17,7 @@ var (
// DownloadGitRepository downloads the target git repository on the disk
// The first return value represents the commit hash of the downloaded git repository
func DownloadGitRepository(config gittypes.RepoConfig, gitService portainer.GitService, getProjectPath func() string) (string, error) {
func DownloadGitRepository(ctx context.Context, config gittypes.RepoConfig, gitService portainer.GitService, getProjectPath func() string) (string, error) {
username := ""
password := ""
if config.Authentication != nil {
@@ -26,6 +27,7 @@ func DownloadGitRepository(config gittypes.RepoConfig, gitService portainer.GitS
projectPath := getProjectPath()
err := gitService.CloneRepository(
ctx,
projectPath,
config.URL,
config.ReferenceName,
@@ -44,6 +46,7 @@ func DownloadGitRepository(config gittypes.RepoConfig, gitService portainer.GitS
}
commitID, err := gitService.LatestCommitID(
ctx,
config.URL,
config.ReferenceName,
username,