Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVCON-7212: Upgrade atlantis to Go 1.23 #770

Merged
merged 10 commits into from
Sep 10, 2024
Prev Previous commit
Next Next commit
lint is fixed
miguelmolina95 committed Sep 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e5b0d856a8e8f4a1d50cdfcd2ee56feed524f479
2 changes: 1 addition & 1 deletion server/legacy/core/runtime/show_step_runner.go
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ func (p *ShowStepRunner) Run(ctx context.Context, prjCtx command.ProjectContext,
return output, errors.Wrap(err, "running terraform show")
}

if err := os.WriteFile(showResultFile, []byte(output), os.ModePerm); err != nil {
if err := os.WriteFile(showResultFile, []byte(output), 0600); err != nil {
return "", errors.Wrap(err, "writing terraform show result")
}

10 changes: 5 additions & 5 deletions server/legacy/events/working_dir_iterator_test.go
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ func TestListCurrentWorkingDirPulls(t *testing.T) {

baseDir := t.TempDir()

_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), os.ModePerm)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), 0600)

pegomock.When(mockGHClient.GetPullRequestFromName("repo1", "nish", 1)).ThenReturn(expectedGithubPull, nil)
pegomock.When(mockEventParser.ParseGithubPull(expectedGithubPull)).ThenReturn(expectedInternalPull, models.Repo{}, models.Repo{}, nil)
@@ -112,8 +112,8 @@ func TestListCurrentWorkingDirPulls(t *testing.T) {

baseDir := t.TempDir()

_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), os.ModePerm)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "2", "default"), os.ModePerm)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), 0600)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "2", "default"), 0600)

pegomock.When(mockGHClient.GetPullRequestFromName("repo1", "nish", pullNum1)).ThenReturn(expectedGithubPull1, nil)
pegomock.When(mockGHClient.GetPullRequestFromName("repo1", "nish", pullNum2)).ThenReturn(expectedGithubPull2, nil)
@@ -156,8 +156,8 @@ func TestListCurrentWorkingDirPulls(t *testing.T) {

baseDir := t.TempDir()

_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), os.ModePerm)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo2", "2", "default"), os.ModePerm)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo1", "1", "default"), 0600)
_ = os.MkdirAll(filepath.Join(baseDir, "repos", "nish", "repo2", "2", "default"), 0600)

pegomock.When(mockGHClient.GetPullRequestFromName("repo1", "nish", pullNum1)).ThenReturn(expectedGithubPull1, nil)
pegomock.When(mockGHClient.GetPullRequestFromName("repo2", "nish", pullNum2)).ThenReturn(expectedGithubPull2, nil)
2 changes: 1 addition & 1 deletion server/neptune/workflows/activities/file/writer.go
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ import "os"
type Writer struct{}

func (f *Writer) Write(name string, data []byte) error {
return os.WriteFile(name, data, os.ModePerm)
return os.WriteFile(name, data, 0600)
}
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ func (c *Credentials) safeReadFile(file string) (string, error) {
}

func (c *Credentials) writeConfig(file string, contents []byte) error {
if err := c.safeWriteFile(file, contents, os.ModePerm); err != nil {
if err := c.safeWriteFile(file, contents, 0600); err != nil {
return err
}
if err := c.Git("config", "--global", "credential.helper", "store"); err != nil {
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ func TestRefresh(t *testing.T) {
credentialsFile := filepath.Join(dir, ".git-credentials")
oldContents := "https://x-access-token:[email protected]"

err := os.WriteFile(credentialsFile, []byte(oldContents), os.ModePerm)
err := os.WriteFile(credentialsFile, []byte(oldContents), 0600)
assert.NoError(t, err)

capturedGitArgs := [][]string{}
@@ -159,7 +159,7 @@ func TestRefresh(t *testing.T) {
credentialsFile := filepath.Join(dir, ".git-credentials")
oldContents := "https://x-access-token:[email protected]"

err := os.WriteFile(credentialsFile, []byte(oldContents), os.ModePerm)
err := os.WriteFile(credentialsFile, []byte(oldContents), 0600)
assert.NoError(t, err)

tc := &testInstallationTransport{
6 changes: 3 additions & 3 deletions server/neptune/workflows/deploy_test.go
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ func buildConfig(t *testing.T) config.Config {
dataDir := t.TempDir()

// storage client uses this for it's local backend.
err = os.Mkdir(filepath.Join(dataDir, "container"), os.ModePerm)
err = os.Mkdir(filepath.Join(dataDir, "container"), 0600)
assert.NoError(t, err)
conftestVersion, err := version.NewVersion("0.25.0")
assert.NoError(t, err)
@@ -238,13 +238,13 @@ var fileContents = ` resource "null_resource" "null" {}
func GetLocalTestRoot(ctx context.Context, dst, src string) error {
// dst will be the repo path here but we also need to create the root itself
dst = filepath.Join(dst, "terraform", "mytestroot")
err := os.MkdirAll(dst, os.ModePerm)
err := os.MkdirAll(dst, 0600)

if err != nil {
return errors.Wrapf(err, "creating directory at %s", dst)
}

if err := os.WriteFile(filepath.Join(dst, "main.tf"), []byte(fileContents), os.ModePerm); err != nil {
if err := os.WriteFile(filepath.Join(dst, "main.tf"), []byte(fileContents), 0600); err != nil {
return errors.Wrapf(err, "writing file")
}