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 SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos #256

Conversation

ivan-hernandez-scopely
Copy link
Contributor

@ivan-hernandez-scopely ivan-hernandez-scopely commented May 5, 2021

Changes

Usage


      - name: Setup SSH Agent
        uses: webfactory/ssh-agent@v0.5.2
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

      - name: Unity Builder
        uses: ivan-hernandez-scopely/unity-builder@feature/ssh-agent-for-private-upm
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
        with:
          projectPath: ${{ matrix.projectPath }}
          targetPlatform: ${{ matrix.targetPlatform }}
          sshAgent: ${{ env.SSH_AUTH_SOCK }}

Checklist

  • Read the contribution guide and accept the code of conduct
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

@github-actions
Copy link

github-actions bot commented May 5, 2021

Cat Gif

@ivan-hernandez-scopely ivan-hernandez-scopely force-pushed the feature/ssh-agent-for-private-upm branch from 89441fd to 49a6983 Compare May 6, 2021 13:45
@ivan-hernandez-scopely ivan-hernandez-scopely marked this pull request as draft May 8, 2021 18:36
@ivan-hernandez-scopely ivan-hernandez-scopely force-pushed the feature/ssh-agent-for-private-upm branch from 49a6983 to cac9b2d Compare May 17, 2021 14:13
@ivan-hernandez-scopely ivan-hernandez-scopely marked this pull request as ready for review May 17, 2021 17:17
@ivan-hernandez-scopely ivan-hernandez-scopely force-pushed the feature/ssh-agent-for-private-upm branch from d5ec3c9 to f8ebc05 Compare May 20, 2021 18:22
@webbertakken
Copy link
Member

This looks like a great approach to me.

The hardest part about merging this is actually figuring out whether this would be the default approach that we'll support from here on forward (or risk bc break in future versions) @davidmfinol @GabLeRoux @frostebite please let me know your thoughts on this.

dist/Dockerfile Outdated
@@ -17,4 +17,6 @@ ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN ls

RUN apt-get update && apt-get install -y openssh-client
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add openssh-client to the base image. We've been trying to work around it but use cases keep popping up that require this.

Does your use-case work without recommends (how we usually install packages in the base image)?

Copy link
Member

Choose a reason for hiding this comment

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

@webbertakken is there any alternative? My understanding is this demonstrates a situation we simply need it?

Copy link
Member

@webbertakken webbertakken May 23, 2021

Choose a reason for hiding this comment

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

I agree. I think we need this, but not as part of builder. This is why I'm suggesting to move it to the base image.

The base image installs everything with the flag --no-install-recommends, to keep the image as small as possible.

The reason I'm asking is that it would be too much for me to check these kind of things for every PR by myself (as it requires reproducing exact use cases).

@webbertakken
Copy link
Member

What made you chose this approach over mounting ~/.ssh/ (which is an existing mount)?

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2021

Codecov Report

Merging #256 (c28d546) into main (71ca7bd) will decrease coverage by 0.10%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #256      +/-   ##
==========================================
- Coverage   56.32%   56.21%   -0.11%     
==========================================
  Files          23       23              
  Lines         767      772       +5     
  Branches      143      147       +4     
==========================================
+ Hits          432      434       +2     
- Misses        334      337       +3     
  Partials        1        1              
Impacted Files Coverage Δ
src/model/build-parameters.ts 100.00% <ø> (ø)
src/model/docker.ts 17.64% <0.00%> (-3.79%) ⬇️
src/model/input.ts 100.00% <100.00%> (ø)

@ivan-hernandez-scopely ivan-hernandez-scopely force-pushed the feature/ssh-agent-for-private-upm branch from db16958 to fe464b5 Compare May 27, 2021 13:34
dist/Dockerfile Outdated Show resolved Hide resolved
@webbertakken webbertakken merged commit 497f2f7 into game-ci:main May 28, 2021
@webbertakken
Copy link
Member

webbertakken commented May 28, 2021

Great work. Thank you very much!

Note that this will start working only after 0.14 of the docker images has been released.

@uchar
Copy link

uchar commented May 31, 2021

@ivan-hernandez-scopely Does your solution works with private GitHub repositories?

@ivan-hernandez-scopely ivan-hernandez-scopely deleted the feature/ssh-agent-for-private-upm branch May 31, 2021 07:30
@ivan-hernandez-scopely
Copy link
Contributor Author

ivan-hernandez-scopely commented May 31, 2021

@ivan-hernandez-scopely Does your solution works with private GitHub repositories?

Note that this will start working only after 0.14 of the docker images has been released

@uchar yes. Notice that you need to provide the ssh private key to the webfactory/ssh-agent as a github secret:

And setup its ssh public key in:

@uchar
Copy link

uchar commented Jun 4, 2021

@webbertakken When does the new version going to release?

@webbertakken
Copy link
Member

@uchar I should have time in the weekend.

In the meantime you can use the specific commit hash until the new version is there.

@ivan-hernandez-scopely
Copy link
Contributor Author

@uchar I should have time in the weekend.

In the meantime you can use the specific commit hash until the new version is there.

But this commit hash will require the docker images 0.14 released. right?

@webbertakken
Copy link
Member

Oh yes, you're right. I was waiting for game-ci/docker#116 to be merged for that. It's currently pending a last change.

@uchar
Copy link

uchar commented Jul 8, 2021

@webbertakken Can you please release the new version, I really need this 🙏

@webbertakken
Copy link
Member

Thanks for the heads-up. Indeed, the other PR doesn't seem to be moving as fast as we'd hoped.

I just released a new version for both docker and builder. Please follow the progress of the docker images on our image versions page. Please allow up to 24 hours for all of them to be published.

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

Successfully merging this pull request may close these issues.

5 participants