-
Notifications
You must be signed in to change notification settings - Fork 16
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
Initial working commit #136
Conversation
Only remaining question is what to call the I thought about Open to thoughts/suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Approved. Left some suggestions though
@@ -107,8 +106,7 @@ func getDescription(t *templatecache.TemplateData) error { | |||
var ignoredTemplateDirs = map[string]bool{"alpha": true} | |||
|
|||
func getTemplate(t *templatecache.TemplateData) error { | |||
var fs = afero.NewOsFs() | |||
cache, _ := templatecache.NewBundleTemplateCache(templatecache.GithubTemplatesFetcher, fs) | |||
cache, _ := templatecache.NewBundleTemplateCache(templatecache.GithubTemplatesFetcher) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a lint recommendation below, won't allow me to comment on it
pkg/bundle/write_schemas.go
Outdated
@@ -39,7 +38,7 @@ func (b *Bundle) WriteSchemas(buildPath string, fs afero.Fs) error { | |||
|
|||
filepath := fmt.Sprintf("/schema-%s.json", task.label) | |||
|
|||
err = afero.WriteFile(fs, path.Join(buildPath, filepath), content, 0755) | |||
err = os.WriteFile(path.Join(buildPath, filepath), content, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would change perms to 0600
or add lint exclusion like //nolint:gosec
to L17
writePath := "." | ||
testDir := t.TempDir() | ||
rootTemplateDir := path.Join(testDir, "/home/md-cloud") | ||
writePath := testDir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would look nicer to remove L20 and replace all writePath
to testDir
, or replace testDir
with writePath
pkg/server/bundle/bundle.go
Outdated
@@ -302,7 +300,7 @@ func (h *Handler) postConnections(w http.ResponseWriter, r *http.Request) { | |||
return | |||
} | |||
|
|||
err = afero.WriteFile(h.fs, path.Join(h.bundleDir, "src", bundle.ConnsFile), bytes, 0755) | |||
err = os.WriteFile(path.Join(h.bundleDir, "src", bundle.ConnsFile), bytes, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment about lint as above
pkg/terraform/generate_files.go
Outdated
@@ -83,7 +83,7 @@ func generateTfVarsFiles(buildPath, stepPath string, b *bundle.Bundle, fs afero. | |||
} | |||
|
|||
filePath := fmt.Sprintf("/_%s_variables.tf.json", task.label) | |||
err = afero.WriteFile(fs, path.Join(buildPath, stepPath, filePath), content, 0755) | |||
err = os.WriteFile(path.Join(buildPath, stepPath, filePath), content, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
emptyConnections := checkEmptySchema(b.Connections) | ||
|
||
if emptyConnections { | ||
err := afero.WriteFile(fs, path, []byte("{}"), 0755) | ||
err := os.WriteFile(path, []byte("{}"), 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -40,7 +40,7 @@ func transpileConnectionVarFile(path string, b *bundle.Bundle, fs afero.Fs) erro | |||
return err | |||
} | |||
|
|||
err = afero.WriteFile(fs, path, bytes, 0755) | |||
err = os.WriteFile(path, bytes, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
emptyParams := checkEmptySchema(b.Params) | ||
|
||
if emptyParams { | ||
err := afero.WriteFile(fs, path, []byte("{}"), 0755) | ||
err := os.WriteFile(path, []byte("{}"), 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -59,7 +59,7 @@ func transpileAndWriteDevParams(path string, b *bundle.Bundle, fs afero.Fs) erro | |||
return err | |||
} | |||
|
|||
err = afero.WriteFile(fs, path, bytes, 0755) | |||
err = os.WriteFile(path, bytes, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Pretty simple change that touched a lot of files. Pulling out the
afero
mockfilesystem stuff. It was useful in testing, but some of our dependencies (airlock
) perform filesystem access which makes it very difficult to maintain. There was really only 3 categories of changes here:afero
filesystem calls (ReadFile
,WriteFile
, etc) to their corresponding functions inos
orfilepath
TempDir
.