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 — [apply] execute make in each project by thdaraujo · Pull Request #145 · commitdev/zero

Conversation

@thdaraujo

@thdaraujo thdaraujo commented Jun 2, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Apply Command [closes #132]

This MR will add the zero apply basic functionality.

zero apply loads the zero-project.yaml config file and executes make on each module folder of a specific project, passing environment variables as received by the command.

The zero-project.yaml file was changed to reflect the spec (link). Notice the change to the modules attribute from a list to just a single map of modulues. See example below:

name: abc

context:

modules:
    infrastructure:
        parameters:
            repoName: infrastructure
            region: us-east-1
            accountId: 12345
            productionHost: something.com
        files:
            dir: infrastructure
            repo: https://github.com/myorg/infrastructure
    aws-eks-stack:
        files:
            dir: zero-aws-eks-stack
            repo: github.com/commitdev/zero-aws-eks-stack
    deployable-backend:
        files:
            dir: zero-deployable-backend
            repo: github.com/commitdev/zero-deployable-backend
    deployable-react-frontend:
        files:
            dir: zero-deployable-react-frontend
            repo: github.com/commitdev/zero-deployable-react-frontend

The struct projectconfig.ZeroProjectConfig that holds the unmarshalled config information was also changed to reflect that.

Some changes to the zero init function were also needed, like marshalling the config context that the user fills in during the execution of init and saving the zero-project.yaml file, and everything related to the struct.

Sorry, something went wrong.

Uh oh!

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

All reactions
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from e683ff4 to 1ae62bc Compare June 3, 2020 00:52
@thdaraujo thdaraujo changed the title [apply] execute make in each project (WIP) [apply] execute make in each project Jun 3, 2020
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch 2 times, most recently from 423ea69 to 4d64652 Compare June 4, 2020 19:33
@thdaraujo
thdaraujo marked this pull request as ready for review June 6, 2020 03:08
@thdaraujo thdaraujo changed the title (WIP) [apply] execute make in each project [apply] execute make in each project Jun 6, 2020
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from 541970b to 5428e94 Compare June 7, 2020 20:42
@thdaraujo thdaraujo self-assigned this Jun 8, 2020
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/config/projectconfig/project_config.go Outdated
Infrastructure Infrastructure // TODO simplify and flatten / rename?
Context map[string]string
Modules []string
Name string `yaml:"name"`

@bmonkman bmonkman Jun 8, 2020

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.

This will likely cause conflicts with @dtoki 's stuff but we can figure it out.

Sorry, something went wrong.

Uh oh!

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

All reactions
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/config/projectconfig/apply.go Outdated
@@ -0,0 +1,43 @@
package projectconfig

@bmonkman bmonkman Jun 8, 2020

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.

I don't think this is the right place for this. Maybe move to an internal/apply package?

Sorry, something went wrong.

Uh oh!

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

thdaraujo reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/context/apply.go Outdated
@@ -0,0 +1,65 @@
package context

@bmonkman bmonkman Jun 8, 2020

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.

Move to an internal/apply package?

Sorry, something went wrong.

Uh oh!

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

thdaraujo reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/context/apply.go
fmt.Println(`Choose the environments to apply. This will create infrastructure, CI pipelines, etc.
At this point, real things will be generated that may cost money!
Only a single environment may be suitable for an initial test, but for a real system we suggest setting up both staging and production environments.`)
applyEnvironments = promptEnvironments()

@bmonkman bmonkman Jun 8, 2020

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.

This won't affect the value of applyEnvironments in the calling code, but it might be better to merge this and the stuff in the other file into the same package anyway.

Sorry, something went wrong.

Uh oh!

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

thdaraujo reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/context/init.go Outdated

// loadAllModules takes a list of module sources, downloads those modules, and parses their config
func loadAllModules(moduleSources []string) map[string]moduleconfig.ModuleConfig {
func loadAllModules(moduleSources projectconfig.Modules) map[string]moduleconfig.ModuleConfig {

@bmonkman bmonkman Jun 8, 2020

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.

This shouldn't accept projectconfig.Modules, just a slice of string. At this point there is no project config and all we have are some repo paths.

Sorry, something went wrong.

Uh oh!

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

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

@thdaraujo thdaraujo Jun 9, 2020 •
edited
Loading

Uh oh!

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

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.

changed it back to a []string

Sorry, something went wrong.

Uh oh!

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

All reactions

@bmonkman bmonkman Jun 9, 2020

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.

Thanks, could you remove the changes to the registry section as well?

Sorry, something went wrong.

Uh oh!

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

All reactions

@thdaraujo thdaraujo Jun 10, 2020

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.

done!

Sorry, something went wrong.

Uh oh!

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

All reactions
bmonkman
bmonkman reviewed Jun 8, 2020
View reviewed changes
Comment thread internal/config/projectconfig/apply.go Resolved

Uh oh!

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

bmonkman
bmonkman suggested changes Jun 8, 2020
View reviewed changes

@bmonkman bmonkman left a comment

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.

Some changes requested

Sorry, something went wrong.

Uh oh!

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

All reactions
bmonkman
bmonkman reviewed Jun 9, 2020
View reviewed changes
Comment thread internal/util/util.go

// AppendProjectEnvToCmdEnv will add all the keys and values from envMap
// into envList as key-value pair strings (e.g.: "key=value")
func AppendProjectEnvToCmdEnv(envMap map[string]string, envList []string) []string {

@bmonkman bmonkman Jun 9, 2020

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.

This will conflict with a change in David's PR since he also moved this function. But I agree it should be here in util.

Sorry, something went wrong.

Uh oh!

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

All reactions
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from 986cbae to b7e908d Compare June 10, 2020 02:27
bmonkman
bmonkman approved these changes Jun 10, 2020
View reviewed changes

@bmonkman bmonkman left a comment

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.

Nice! Thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
thdaraujo added 6 commits June 10, 2020 11:08
@thdaraujo
adds apply command
6799dc6
Runs `make` on every created project folder [related to #132]
@thdaraujo
zero apply context (WIP)
de27965
@thdaraujo
changes example config tabs to spaces
3926600
the reason is because yaml does not support tabs
@thdaraujo
changes ZeroProjectConfig.Modules structure and yaml file
9998eb4
@thdaraujo
marshall and save config file
1b38e8c
@thdaraujo
apply path fix
9cb7d30
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from ddbb4e7 to fc0217e Compare June 10, 2020 18:27
thdaraujo added 4 commits June 10, 2020 11:38
@thdaraujo
adds tests for apply output and sample project
c3d0fa0
@thdaraujo
loadAllModules should accept a slice of string
945146b
@thdaraujo
append module parameters when running apply
aef6b57
@thdaraujo
moving apply to internal/apply
5c6786c
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from fc0217e to 2e2718a Compare June 10, 2020 18:39
@thdaraujo
fix initialization of config
51b52d5
@thdaraujo
thdaraujo force-pushed the ta/make-projects branch from 2e2718a to 51b52d5 Compare June 10, 2020 18:46
bmonkman
bmonkman approved these changes Jun 10, 2020
View reviewed changes
@thdaraujo
thdaraujo merged commit dbfbb43 into master Jun 10, 2020
@thdaraujo
thdaraujo deleted the ta/make-projects branch June 10, 2020 21:26
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

@thdaraujo thdaraujo

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Apply Command - Execute make in each project

Uh oh!

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

2 participants

@thdaraujo @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.