GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [SEMVER-MAJOR] condition support to module params by davidcheung · Pull Request #350 · commitdev/zero

Conversation

@davidcheung

@davidcheung davidcheung commented Mar 3, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

feature changes includes:

  • removing global config [breaking change]
  • module config’s parameter to support conditions (all conditions must be true)
  • module config’s parameter to support custom typed prompts (eg. AWS prompt - [x]ype)
  • module config parameter to support overwriting the env-var used when apply
  • module config parameter to support processing used parameters (OmitFromProjectFile default's to false)

behaviour changes includes:

  • prompts(function) to not return value, instead update map(can support multi-value)
  • some parameter names improved (so the code is more readable)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
davidcheung added 3 commits March 3, 2021 15:59
@davidcheung
[SEMVER-MAJOR] condition support to module params
baebfcf
changes includes
- removing global config
- module config’s parameter to support condition
- module config’s parameter to support custom typed prompts
- prompts to not return value, instead update map(can support multi-value)
@davidcheung
remove credentials
57917de
@davidcheung
dynamically populate from struct
cd0fd51
@davidcheung
davidcheung marked this pull request as ready for review March 9, 2021 01:06
@davidcheung
allow overwriting the env-var while apply
7713479
@davidcheung
davidcheung force-pushed the remove-credential-file branch from 0d6aec2 to 7713479 Compare March 9, 2021 01:06
@bmonkman

bmonkman commented Mar 9, 2021

Copy link
Copy Markdown
Contributor

Go convention - can you please add comments on public functions starting with the name of the function?

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davidcheung added 5 commits March 9, 2021 15:55
@davidcheung
add comments to public functions
f4073e4
@davidcheung
fixup! add comments to public functions
5bdb4d2
@davidcheung
fixup! fixup! add comments to public functions
8c0fc81
@davidcheung
fixup! fixup! fixup! add comments to public functions
a11fbca
@davidcheung
fixup! fixup! fixup! fixup! add comments to public functions
fec369d
bmonkman
bmonkman reviewed Mar 9, 2021
View reviewed changes
Comment thread internal/apply/apply.go Outdated
})
}

func getParameterDefinition(modConfig moduleconfig.ModuleConfig, field string) moduleconfig.Parameter {

@bmonkman bmonkman Mar 9, 2021

Copy link
Copy Markdown
Contributor

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.

Is this function not actually used anywhere?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Mar 9, 2021

Copy link
Copy Markdown
Contributor Author

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.

Yeah looks like it, will remove

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bmonkman

bmonkman commented Mar 9, 2021

Copy link
Copy Markdown
Contributor

Can you add a new file in docs to capture the schema and usage of the module.yml now that it's getting more complex?

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 9, 2021
View reviewed changes
Comment thread internal/config/moduleconfig/module_config.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 9, 2021
View reviewed changes
Comment thread internal/config/moduleconfig/module_config.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 9, 2021
View reviewed changes
Comment thread internal/config/moduleconfig/module_config.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread internal/config/projectconfig/project_config.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread pkg/credentials/credentials.go Outdated
SecretAccessKey string `yaml:"secretAccessKey,omitempty" env:"AWS_SECRET_ACCESS_KEY,omitempty"`
}

var GetAWSCredsPath = awsCredsPath

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Why assign here rather than calling the function directly?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Mar 10, 2021

Copy link
Copy Markdown
Contributor Author

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.

In the tests i'm overwriting the function so it fetches the mock path, it only lets me do it if its a variable
what's the proper way to

I guess I should just have the function receive the credentials path as well?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Yeah how about you accept an optional base path, and if it's not supplied we default to the home dir?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread internal/util/util.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread pkg/credentials/credentials.go Outdated

func AwsCredsPath() string {
type AWSResourceConfig struct {
AccessKeyID string `yaml:"accessKeyId,omitempty" env:"AWS_ACCESS_KEY_ID,omitempty"`

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Why "yaml"? If this annotation is just to be used by the ReflectStructValueIntoMap function we might as well use our own identifier so it's clear that it's not supposed to be used in some other way to generate yaml.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Mar 10, 2021

Copy link
Copy Markdown
Contributor Author

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.

No particular reason, mostly just because I reused the struct from before (global creds)
what should we change it to, should we just call it zero?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

How about just key or something? If we control this struct entirely in code and don't need to worry about parsing it to/from a file it might be a bit overkill to even use an annotation for this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
davidcheung added 4 commits March 9, 2021 21:42
@davidcheung
address comments
1c62c0c
@davidcheung
fixup! address comments
a09474f
@davidcheung
fixup! fixup! address comments
272f642
@davidcheung
project definition
2d61408
bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread docs/project-definition.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread docs/module-definition.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread docs/module-definition.md
| `data` | list(string) | Supply extra data for condition to run |


### Validation

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Missing info on some of the other things like the contitions and template fields related to templating.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Mar 10, 2021

Copy link
Copy Markdown
Contributor Author

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.

definitely good call to add this documentation, I looked at conditions and thought oh its there, but theres actually 2 types

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Yeah the naming might be a bit confusing..

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman reviewed Mar 10, 2021
View reviewed changes
Comment thread internal/init/prompts.go Outdated
@@ -126,9 +133,11 @@ func (p PromptHandler) GetParam(projectParams map[string]string) string {
exit.Fatal("Exiting prompt: %v\n", err)

@bmonkman bmonkman Mar 10, 2021

Copy link
Copy Markdown
Contributor

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.

Mind adding a bit more info here? Maybe say that it's related to the module properties, and if possible, say which module the problem is with? I'm thinking for CustomPromptHandler for example, if the module specifies an invalid string, it's gonna be hard for a user to understand what's going on.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@davidcheung @bmonkman
Update docs/module-definition.md
28f807b
Co-authored-by: Bill Monkman <[email protected]>
davidcheung and others added 4 commits March 10, 2021 16:02
@davidcheung @bmonkman
Update docs/project-definition.md
b6c2fac
Co-authored-by: Bill Monkman <[email protected]>
@davidcheung
better error message to users
c3b7b6f
@davidcheung
explain template parameters
89dbe41
@davidcheung
condition clarification between module and param
082bbe9
bmonkman
bmonkman approved these changes Mar 11, 2021
View reviewed changes
@davidcheung
davidcheung merged commit 7f4c7a3 into main Mar 11, 2021
@davidcheung
davidcheung deleted the remove-credential-file branch March 11, 2021 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@bmonkman bmonkman bmonkman approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@davidcheung @bmonkman
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.