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

lerna publish from-package fails in AWS CodeBuild #1933

Closed
samlecuyer opened this issue Feb 13, 2019 · 4 comments
Closed

lerna publish from-package fails in AWS CodeBuild #1933

samlecuyer opened this issue Feb 13, 2019 · 4 comments
Assignees

Comments

@samlecuyer
Copy link

AWS CodePipeline does not provide the .git directory or git executable to CodeBuild jobs, even when sourcing the code from a CodeCommit repository. The step to add gitHead to each package fails and cannot publish due to the error.

Expected Behavior

lerna should be able to publish in a non-git environment using from-package

Current Behavior

> lerna publish from-package --no-git-reset
 lerna notice cli v3.11.1
lerna ERR! ENOGIT The git binary was not found, or this is not a git repository.

Possible Solution

Maybe make the gitHead step optional or fail silently in non-git environments.

Steps to Reproduce (for bugs)

  1. Create a monorepo with at least one package
  2. Remove git from your path and .git, if any exist
  3. lerna publish from-package
lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "0.1.0"
}

Context

I'm investigating using a monorepo with our existing infrastructure, which is AWS. We cannot use lerna with AWS Developer Tools unless it can publish gitless. I do not expect version to work without git (that should be done by people on their dev machines), but publish should.

Your Environment

Running in AWS CodeBuild, Ubuntu, Node.JS 10.14.1.

Executable Version
lerna --version v3.11.1
npm --version 6.7.0
yarn --version VERSION
node --version 10.14.1
@samlecuyer
Copy link
Author

Digging into the CodeBuild docs, it looks like there's a CODEBUILD_SOURCE_VERSION env var that's passed to the build job. A possible solution to this might also be to allow a hash to be passed so that the publish step doesn't need git.

lerna publish from-package --with-git-head 44d86a1...

@evocateur
Copy link
Member

Yep, that certainly makes sense. A similar approach to #1908 is what I'm thinking (noodling locally right now). There are a couple more places we need to be aware of "do i need git", but it's actually not bad.

I think a (simplified) --git-head option would be a nice DX improvement, to preserve the gitHead metadata available from the registry.

@evocateur evocateur self-assigned this Feb 13, 2019
evocateur added a commit to evocateur/lerna that referenced this issue Feb 13, 2019
@evocateur
Copy link
Member

@samlecuyer How does this look?

@samlecuyer
Copy link
Author

@evocateur this is amazing, thank you for being so responsive! API-wise, it looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants