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

meta-dts workflow can delete ~/.ssh/config in some exceptional situations #954

Closed
iwanicki92 opened this issue Jul 18, 2024 · 5 comments · Fixed by Dasharo/meta-dts#146
Closed
Assignees
Labels

Comments

@iwanicki92
Copy link

iwanicki92 commented Jul 18, 2024

Component

Dasharo Tools Suite

Device

other

Dasharo version

No response

Dasharo Tools Suite version

No response

Test case ID

No response

Brief summary

Stopped/failed CI action can delete ~/.ssh/config which will lead to failure on next run

How reproducible

Always

How to reproduce

  • Push tag or rerun workflow that's run on tag push
  • Cancel immediately (before second job starts/DTS finishes building)
  • Repeat step 1

Expected behavior

Previous workflow errors shouldn't influence current one

Actual behavior

workflow fails because previous action change expected state
https://github.com/Dasharo/meta-dts/actions/runs/9997346441/job/27634154969

Screenshots

No response

Additional context

https://github.com/Dasharo/meta-dts/actions/runs/9996958212/job/27633519716
and
https://github.com/Dasharo/meta-dts/actions/runs/9997346441/job/27634154969

  • Second job creates config-old: ci.yml
  • Third job (cleanup) is always run (even on failures) ci.yml
    • deletes config
    • moves config-old to config

If workflow is stopped before second job then config is deleted in third and next step fails because there is no config-old to move.
Next run fails on second job because in previous job config was deleted but not recreated.

Solutions you've tried

Not tested but quick fix would be to remove rm -f ~/.ssh/config.
Next step (mv ~/.ssh/config-old ~/.ssh/config) would still fail in this case but config wouldn't be deleted.

@iwanicki92 iwanicki92 added bug Something isn't working needs review labels Jul 18, 2024
@artur-rs artur-rs assigned artur-rs, tym2k1 and PLangowski and unassigned artur-rs Jul 24, 2024
@PLangowski
Copy link

How about moving cp ~/.ssh/config ~/.ssh/config-old to the beginning of the first workflow? That would reduce the probability of config-old not existing.

@macpijan
Copy link
Contributor

macpijan commented Jul 24, 2024

How about simply create from scratch a config for this job, and do not touch original ~/.ssh/config at all?

This seems like the core of the problem, unnecessary complexity.

Refer to the manual:


       -F ssh_config
               Specifies an alternative per-user configuration file for ssh.  This option is directly passed to ssh(1).

@m-iwanicki
Copy link

@PLangowski I guess it's ok, this way clean job would most likely always succeed, but I would still remove rm part and leave only mv.
Or you can do it as @macpijan said and maybe create copy of ~/.ssh/config if it's needed.

@m-iwanicki m-iwanicki linked a pull request Jul 26, 2024 that will close this issue
@PLangowski
Copy link

@m-iwanicki the PR has been merged. Can you close this issue or is there something more to be done?

@m-iwanicki
Copy link

@PLangowski Closed, I wonder why it wasn't closed automatically when PR was merged.

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

Successfully merging a pull request may close this issue.

6 participants