-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Build a Docker image from source code #810
Conversation
Coo, yeah, as long as it's caching I'm 👍 with this |
Thanks for the PR @dtinth. The Danger org conform to the Moya Community Continuity Guidelines, which means So, we've sent you an org invite - thanks dtinth 🎉 Generated by 🚫 dangerJS |
@dtinth Are you able to cache the build in GitHub actions? |
We were able to cache the Docker layers while in beta. The workflow syntax has since changed and I did not update the project to use the new workflow. (We ended up creating our own system where results from multiple builds are aggregated together into a single comment.) So, I am not sure what the situation is now... |
I’ve made several test with GitHub actions in order to improve the danger-swift compile time, and AFAIK there is no relevant speed improvement given by a layer cache on the second run of an action at the moment. |
Personally, I'd recommend not using the GitHub Action and just calling danger from npm/yarn unless you're not in a JavaScript project - the abstraction overhead of docker is definitely not worth it |
@orta are there plans to update the image on https://hub.docker.com? It would allow people to do |
I've tried a few times, but not got it working and last time my creds got leaked by docker hub so I'm not really looking forwards to doing it again https://github.com/danger/danger-js/blob/master/.github/workflows/uploadDockerImage.yml |
I'm pretty sure I can fix it, by using the script we have on danger/swift. The only problem with that is that packages requires auth even for public packages, then while it could be used for example in CircleCI where you can specify the auth credentials to download an docker image, it can not be used on Github Actions |
Yes, GitHub registry requires auth so https://hub.docker.com is probably a better option. |
Personally I agree with @orta, and the |
That is valid only if you are using Actions, a Docker image can be used easily in any environment and CI that supports docker. |
Problems
We struggle with getting the GitHub Actions to work on our project, but it is not easy to debug Danger when running on GitHub Actions. We’ve tried setting
DEBUG=*
and--verbose
to no avail.We tried forking Danger JS, but since its Dockerfile always install
danger-js
from the npm registry (vianpx danger@beta
), it is not easy for us to modify the source code and debug Danger on GitHub actions.Upon inspecting the npm registry I found that the beta tag is two major versions behind.
danger@latest
is at v7.0.2, whereasdanger@beta
is at v5.0.0-beta.24. That means people running Danger on GitHub Actions, following the documentation are running an utterly outdated version of Danger.Solution
I updated the Dockerfile so that it always compile Danger from source code. This means:
People can use a specific version of Danger via
uses = "danger/danger-js@v7.0.3"
or use a cutting edge version viauses = "danger/danger-js@master"
.People can fork
danger-js
and use it right away viauses = "<username>/danger-js@master"
.By using the latest version of Danger. The problem is gone — our configuration works now.
Caveat
It will take a longer time to run Danger the first time, due to compiling TypeScript from source code (I used
yarn run build:fast
for faster build). This takes ~2 minutes.But subsequent runs will be faster, as Docker cache is used. For example, here, on subsequent runs
---> Using cache
is present in all steps.