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

NodeJS support #183

Merged
merged 5 commits into from Jul 2, 2019
Merged

Conversation

michelvocks
Copy link
Member

@michelvocks michelvocks commented Jun 29, 2019

Fixes #183

Docs PR: gaia-pipeline/docs#12

@michelvocks michelvocks added the Needs Work The PR still requires some work from the submitter. label Jun 29, 2019
@michelvocks michelvocks self-assigned this Jun 29, 2019
@michelvocks michelvocks added needs review Ready To Merge PR is ready to be merged into master and removed Needs Work The PR still requires some work from the submitter. labels Jul 1, 2019
@michelvocks michelvocks marked this pull request as ready for review July 1, 2019 07:45
@michelvocks michelvocks requested a review from Skarlso July 1, 2019 07:45
@codecov-io
Copy link

Codecov Report

Merging #183 into master will increase coverage by 0.22%.
The diff coverage is 71.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
+ Coverage   62.36%   62.59%   +0.22%     
==========================================
  Files          47       48       +1     
  Lines        3829     3914      +85     
==========================================
+ Hits         2388     2450      +62     
- Misses       1051     1069      +18     
- Partials      390      395       +5
Impacted Files Coverage Δ
workers/scheduler/scheduler.go 65.43% <ø> (-0.31%) ⬇️
workers/scheduler/create_cmd.go 62.5% <0%> (-11.28%) ⬇️
workers/pipeline/ticker.go 48.7% <0%> (-0.65%) ⬇️
workers/pipeline/build_nodejs.go 100% <100%> (ø)
workers/pipeline/pipeline.go 94.11% <100%> (+0.15%) ⬆️
workers/pipeline/update_pipeline.go 52.54% <45.45%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 133a50d...d6aed3d. Read the comment docs.

gaia.Cfg.Logger.Error("error", string(out[:]))
return fmt.Errorf("cannot install ruby gem: %s", string(out[:]))
}
case gaia.PTypeNodeJS:
Copy link
Member

@Skarlso Skarlso Jul 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we'll need to refactor this into something sensible like a plugin type factory of some sorts, because this switch case is getting ridicules. :D

At the very least we should extract the individual legs into small functions. That has the added benefit of noticing commonalities between these legs better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I completely agree.

I personally think for now it's "fine" since we have two or three switches which you need to modify when you add a new language so that's overall not much but for the future, a lot of refactoring will be required!

But that is a problem for the future Michel (😅)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D :D :D Fine. :D

@Skarlso
Copy link
Member

Skarlso commented Jul 2, 2019

Going to give this a spin now.

// PrepareEnvironment prepares the environment before we start the build process.
func (b *BuildPipelineNodeJS) PrepareEnvironment(p *gaia.CreatePipeline) error {
// create uuid for destination folder
uuid := uuid.Must(uuid.NewV4(), nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we generalise to use GenerateRandomUUIDV5?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. We can do that after merge and then for all builders?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Create a ticket. :D

}

// Unpack it
cmd := exec.Command(path, "-xzvf", p.ExecPath, "-C", tmpFolder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we really need the -v flag? I don't think we really need this to be verbose, don't we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the command fails, the output is displayed in the logs. This could be helpful.

Copy link
Member

@Skarlso Skarlso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some remarks. Tested it, rest looks good. :)

@michelvocks michelvocks merged commit e0e26d9 into gaia-pipeline:master Jul 2, 2019
@michelvocks michelvocks deleted the nodejs_support branch July 2, 2019 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Ready To Merge PR is ready to be merged into master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants