Skip to content

Commit 8edfbba

Browse files
committed
code review fixes
1 parent 40a0db6 commit 8edfbba

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

0-bootstrap/README-GitLab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Run the `0-bootstrap/scripts/git_create_branches_helper.sh` script to create the
218218
cd ./envs/shared
219219
```
220220

221-
1. Run the helper script `choose_build_type.sh` to enable Bootstrap GitHub version
221+
1. Run the helper script `choose_build_type.sh` to enable Bootstrap GitLab version
222222
```bash
223223
./scripts/choose_build_type.sh gitlab
224224
```

0-bootstrap/README-Jenkins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ You arrived to these instructions because you are using the `jenkins_bootstrap`
139139
cd ./envs/shared
140140
```
141141

142-
1. Run the helper script `choose_build_type.sh` to enable Bootstrap GitHub version
142+
1. Run the helper script `choose_build_type.sh` to enable Bootstrap Jenkins version
143143
```bash
144144
./scripts/choose_build_type.sh jenkins
145145
```

0-bootstrap/README-Terraform-Cloud.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ You must be authenticated to the VCS provider. See [GitHub authentication](https
136136
cd ./envs/shared
137137
```
138138

139-
1. Run the helper script `choose_build_type.sh` to enable Bootstrap GitHub version
139+
1. Run the helper script `choose_build_type.sh` to enable Bootstrap Terraform Cloud version
140140
```bash
141141
./scripts/choose_build_type.sh terraform_cloud
142142
```

helpers/foundation-deployer/github/github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (g GH) WaitBuildSuccess(t testing.TB, owner, repo, token, commitSha, failur
288288
if err != nil {
289289
return err
290290
}
291-
if utils.IsRetryableError(t, logs) {
291+
if !utils.IsRetryableError(t, logs) {
292292
return fmt.Errorf("%s\nSee:\nhttps://github.com/%s/%s/actions/runs/%d\nfor details", failureMsg, owner, repo, runID)
293293
}
294294
fmt.Println("build failed with retryable error. a new build will be triggered.")

helpers/foundation-deployer/gitlab/gitlab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (g GL) WaitBuildSuccess(t testing.TB, owner, project, token, commitSha, fai
223223
if err != nil {
224224
return err
225225
}
226-
if utils.IsRetryableError(t, logs) {
226+
if !utils.IsRetryableError(t, logs) {
227227
return fmt.Errorf("%s\nSee:\nhttps://gitlab.com/%s/%s/-/jobs/%d\nfor details", failureMsg, owner, project, jobID)
228228
}
229229
fmt.Println("job failed with retryable error. a new job will be triggered.")

helpers/foundation-deployer/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,13 @@ func main() {
183183
}
184184

185185
var envVars map[string]string
186-
if conf.BuildType != stages.BuildTypeGiHub {
186+
187+
switch conf.BuildType {
188+
case stages.BuildTypeGiHub:
187189
envVars = map[string]string{
188190
"TF_VAR_gh_token": conf.GitToken,
189191
}
190-
}
191-
if conf.BuildType == stages.BuildTypeGitLab {
192+
case stages.BuildTypeGitLab:
192193
envVars = map[string]string{
193194
"TF_VAR_gitlab_token": conf.GitToken,
194195
}

helpers/foundation-deployer/utils/files.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,25 @@ func RenameBuildFiles(basePath, targetBuild string) error {
145145
return fmt.Errorf("error renaming file \"%s\": %w", file, err)
146146
}
147147
}
148+
}
148149

149-
// Rename *_BUILD_TYPE.tf.example to *_BUILD_TYPE.tf if they exist.
150-
pattern := filepath.Join(basePath, fmt.Sprintf("*_%s.tf%s", targetBuild, DisableFileSuffix))
151-
files, err := filepath.Glob(pattern)
152-
if err != nil {
153-
return fmt.Errorf("error finding files (target rename): %w", err)
154-
}
150+
// Rename *_BUILD_TYPE.tf.example to *_BUILD_TYPE.tf if they exist.
151+
pattern := filepath.Join(basePath, fmt.Sprintf("*_%s.tf%s", targetBuild, DisableFileSuffix))
152+
files, err := filepath.Glob(pattern)
153+
if err != nil {
154+
return fmt.Errorf("error finding files (target rename): %w", err)
155+
}
155156

156-
for _, file := range files {
157-
baseName := strings.TrimSuffix(file, fmt.Sprintf(".tf%s", DisableFileSuffix))
158-
newName := baseName + ".tf"
157+
for _, file := range files {
158+
baseName := strings.TrimSuffix(file, fmt.Sprintf(".tf%s", DisableFileSuffix))
159+
newName := baseName + ".tf"
159160

160-
fmt.Printf("Renaming \"%s\" to \"%s\"\n", file, newName)
161+
fmt.Printf("Renaming \"%s\" to \"%s\"\n", file, newName)
161162

162-
err := os.Rename(file, newName)
163-
if err != nil {
164-
return fmt.Errorf("error renaming file \"%s\": %w", file, err)
165-
}
163+
err := os.Rename(file, newName)
164+
if err != nil {
165+
return fmt.Errorf("error renaming file \"%s\": %w", file, err)
166166
}
167167
}
168-
169168
return nil
170169
}

0 commit comments

Comments
 (0)