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

Using without Git #4

Open
tero opened this issue Dec 13, 2018 · 8 comments
Open

Using without Git #4

tero opened this issue Dec 13, 2018 · 8 comments

Comments

@tero
Copy link

tero commented Dec 13, 2018

Any plans to support usage without Git information? We are building inside Docker container and there is no git or any version control data available. Now our build fails because no git available and if I add git it will fail because not inside git repository.

I know possibility to give values with environment variables but I rather not pass all author, commit, etc. information to docker.

@jondavidjohn
Copy link
Member

I'm totally open to alternative ways to provide the info, but unfortunately we do need information like the commit hash to properly identify the version of the code we're reporting on.

Any ideas?

@jondavidjohn
Copy link
Member

Do you have access to the GitHub Actions beta? I think you might be able to use our action to report your bundle stats outside your normal build environment, which might help sidestep the issue.

https://github.com/packtracker/github-action

@tomoakley
Copy link

I'm in the same position. Really interested in Packtracker, but the software I work on is built inside a Docker container on CircleCI, where git is not available. Circle sets some env vars, like the Git branch, the commit hash and the author which I can access inside Docker, but not the commit timestamp, message or previous commit. Are those 3 required for packtracker to work?

@jondavidjohn
Copy link
Member

@tomoakley The only think I think you're going to have issues with is not providing the committed_at value. We use that to order commits in the historical view, so you may be able to provide the current unix timestamp and see if that gets you further down the field. It may not be perfectly accurate but may serve your purposes.

Definitely need to think about this problem further 🤔

@tomoakley
Copy link

tomoakley commented Jun 25, 2019

@jondavidjohn setting the committed_at option in the webpack config worked; looks like this:

new PacktrackerPlugin({
  fail_build: false,
  committed_at: Math.round(new Date().getTime() / 1000),
}),

the docker-compose config looks like this:

environment:
    - PT_PROJECT_TOKEN
    - PT_UPLOAD=true
    - PT_BRANCH=${CIRCLE_BRANCH}
    - PT_COMMIT=${CIRCLE_SHA1}
    - PT_MESSAGE=''
    - PT_AUTHOR=''
    - PT_PRIOR_COMMIT=''

PT_PROJECT_TOKEN is set in the CircleCI environment variable UI, Docker just passes it through. The CIRCLE_BRANCH and CIRCLE_SHA1 variables are provided by the Circle environment.

Thanks for your help!

@jondavidjohn
Copy link
Member

@tomoakley Awesome, thanks a bunch for posting that here.

Hopefully I can come up with a cleaner solution in the future.

@jondavidjohn
Copy link
Member

Anyone following this thread interested in helping me test out an early version of a CircleCI Orb that should help with this issue? Specifically for CircleCI users?

@jondavidjohn
Copy link
Member

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

3 participants