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

Post-run actions on multi-usage #32

Closed
chkpnt opened this issue Jun 22, 2020 · 5 comments · Fixed by #33
Closed

Post-run actions on multi-usage #32

chkpnt opened this issue Jun 22, 2020 · 5 comments · Fixed by #33

Comments

@chkpnt
Copy link

chkpnt commented Jun 22, 2020

First of all, thanks for this GH-Action :-)

I'm using this action twice in my workflow because using a ssh-agent with multiple keys doesn't seem to work with the Gradle-plugin I'm using to push some data to Git-Repositories over ssh.

[...]
      - uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.WORKFLOW_SSH_KEY }}
        continue-on-error: true
      - name: Push data, if there are any changes
        run: ./gradlew gitPublishPush --info

      - uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.WORKFLOW_SSH_KEY_ARCHIV_REPO }}
        continue-on-error: true
      - name: Archive the PDFs in a private repo
        run: ./gradlew -b archive.gradle.kts gitPublishPush --info

This works fine, but I have to use continue-on-error because otherwise, the second post-run-action (which belongs to the first ssh-agent) fails:

grafik

Can I somehow trigger the post-run action manually at an earlier step?

Otherwise, I suggest to check in cleanup.js, if the process is already killed.

execSync('kill ${SSH_AGENT_PID}', { stdio: 'inherit' })

@mpdude
Copy link
Member

mpdude commented Jun 22, 2020

We could make the cleanup.js ignore errors in case the process to be killed is already gone.

Additionally, you might need to kill the first agent before you start the second one.

@mpdude
Copy link
Member

mpdude commented Jun 23, 2020

@chkpnt Please try to use webfactory/ssh-agent@ignore-kill-agent-failure.

When you're done with the first agent, run: kill $SSH_AGENT_PID before you use the action a second time.

chkpnt added a commit to chkpnt/1und1-Servicedienste that referenced this issue Jun 23, 2020
@chkpnt
Copy link
Author

chkpnt commented Jun 23, 2020

Thank you for the quick response :-) I've just given your branch a try:
https://github.com/chkpnt/1und1-Servicedienste/blob/bf64285aeec1f1d1175ed503a682aa94ddc188ef/.github/workflows/update-data.yml#L30-L41

And it's working fine:

grafik

(I'm wondering that some log entries are shown multiple times.... but as the line numbers are the same, that seems to be a GitHub-visualization-issue)

@mpdude
Copy link
Member

mpdude commented Jun 24, 2020

Ok, I will release that shortly.

Any chance you could find out what the underlying issue with Gradle was? Maybe understanding it would help others in the future?

@chkpnt
Copy link
Author

chkpnt commented Jun 24, 2020

The Gradle plugin I use is using @ajoberstar's grgit internally which is using jgit which relies on JSch. I tried to reproduced this issue locally by adding both a wrong and a correct key to ssh-agent, but on my Mac, it's working fine. Don't know, why it behaves different within a GitHub workflow :-/

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

Successfully merging a pull request may close this issue.

2 participants