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

Pass Netrc to normal steps with clone image #1975

Closed
anbraten opened this issue Jul 11, 2023 · 9 comments · Fixed by #2163
Closed

Pass Netrc to normal steps with clone image #1975

anbraten opened this issue Jul 11, 2023 · 9 comments · Fixed by #2163
Labels
breaking will break existing installations if no manual action happens enhancement improve existing features refactor delete or replace old code
Milestone

Comments

@anbraten
Copy link
Member

anbraten commented Jul 11, 2023

Instead of having a separate clone steps list we could simply pass netrc to normal steps with a trusted clone image. This way a user could re-use the clone / git image in the middle of his pipeline and we could consider dropping the extra clone section just leaving the skip_clone keyword

for i, container := range conf.Clone.ContainerList {

- clone:
-    image: woodpeckerci/plugin-git:2.0.3
steps:
  debug:
    image: busybox
    commands:
      - echo something important
+  clone:
+    image: woodpeckerci/plugin-git:2.0.3
  build:
    # ...
@anbraten anbraten added enhancement improve existing features refactor delete or replace old code breaking will break existing installations if no manual action happens labels Jul 11, 2023
@6543
Copy link
Member

6543 commented Jul 11, 2023

this will break the auto detection if a default clone should be added, and I'm not aware of a better impl, option

@anbraten
Copy link
Member Author

Couldn't we always add a clone step and if a user wants to customize it he has to set skip_clone: true?

@6543
Copy link
Member

6543 commented Jul 12, 2023

Well that would work ... I'm personaly in fafour of keeping it seperated, i dont see any upside in merging it. I would rather make an option to expizite insert netrc and make like a secret

@6543
Copy link
Member

6543 commented Jul 12, 2023

I realy wont want to see that people just let inject there netrc into anything ...

They mostly are aware if they create a token, what the impakt is if it got stolen

But tell me how many pople know how netrc works and what an attacker can do with it if it gets extracted

@anbraten
Copy link
Member Author

My suggestion is to just inject it into the clone plugin (so a step with the image=clone and no commands) not into normal steps.

@6543
Copy link
Member

6543 commented Jul 12, 2023

also clone would not run before services anymore ... so if services do depend on it ... they will fail and would have to add there own clone

@anbraten
Copy link
Member Author

No, the normal clone would normally still be there. Its just about passing the Netrc to the clone plugin in the step list. This way I can clone other branches and tags later again. I might just open the PR to make it clear to you.

@6543
Copy link
Member

6543 commented Jul 13, 2023

☝️ ok :)

@lonix1
Copy link
Contributor

lonix1 commented Jul 19, 2023

My use case, originally asked on discord:

Is it possible to move the clone step into the pipeline itself? I tried various ways and syntax, e.g.

#clone      # <-----
steps:
  clone:    # <-----
    git:
      image: woodpeckerci/plugin-git:2.0.3
  build:
    # ...

Someone will ask "why?"... Because 1) it's more understandable, and 2) more importantly, so I can include a "debug" step as the first in the pipeline:

steps:
  debug:                                      # <-----
    image: busybox
    commands:
      - echo '$${CI_REPO_OWNER} = '"${CI_REPO_OWNER}"
      - echo something important
      - echo something else
      - echo something else
      - echo etc...
  clone:
    git:
      image: woodpeckerci/plugin-git:2.0.3
  build:
    # ...

qwerty287 pushed a commit that referenced this issue Aug 8, 2023
@qwerty287 qwerty287 added this to the 1.1.0 milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking will break existing installations if no manual action happens enhancement improve existing features refactor delete or replace old code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants