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

[Feature] Add new properties for raw values #134

Open
EdmonDantes opened this issue Mar 7, 2024 · 2 comments
Open

[Feature] Add new properties for raw values #134

EdmonDantes opened this issue Mar 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@EdmonDantes
Copy link

EdmonDantes commented Mar 7, 2024

Please add properties ssh-key-raw to provide Base64 string of SSH key (not path to file) and custom-cert-raw to provide Base64 string of custom server certificate.

I tried to use this plugin in a Woodpecker with a Kubernetes backend. I can't add Docker volume to clone step, and I can't execute any command (for example to create a file). So I can not create any file and only set values to properties.
I think it will be great if a user can provide a secret's values directly to properties.

@qwerty287 qwerty287 added the enhancement New feature or request label Mar 8, 2024
@OppOops
Copy link

OppOops commented Apr 10, 2024

Here is the suggestion to use normal git commands like this, which will need to change the ssh-key file permission and add the known_hosts in to list.
Below we suppose the git host is github.com :

skip_clone: true
steps:
  - name: clone
    image: alpine/git
    commands:
      #if the content is base64, just decode it with base64 -d ... > pull_key
      - echo "$CLONE_SSH_KEY_CONTENT" > pull_key
      - chmod 600 pull_key
      - mkdir -p /root/.ssh
      - ssh-keyscan github.com >> /root/.ssh/known_hosts
      
      # below commands simiulate the woodpeckerci/pulgin-git
      - git init
      - git remote add origin $CI_REPO_CLONE_SSH_URL
      - git config core.sshCommand 'ssh -i pull_key'
      - git fetch && git checkout $CI_COMMIT_BRANCH
    secrets: [ CLONE_SSH_KEY_CONTENT ]

pull_key will leave in the default workspace. If we use woodpeckerci/plugin-git to fetch the repo, the ~/.ssh/known_hosts needs to be add further. Now I use the clone like the following:

skip_clone: true
steps:
  - name: copy-key
    image: alpine/git
    commands:
      #if the content is base64, just decode it with base64 -d ... > pull_key
      - echo "$CLONE_SSH_KEY_CONTENT" > pull_key
      - chmod 600 pull_key
      - mkdir -p /root/.ssh
      - ssh-keyscan github.com >> /root/.ssh/known_hosts
    secrets: [ CLONE_SSH_KEY_CONTENT ]

  - name: clone
    image: woodpeckerci/plugin-git
    settings:
      - use-ssh : true
      - ssh-key : pull_key

@ser
Copy link

ser commented Nov 27, 2024

It's very inconvenient to use a special alpine image just to make such a simple operation, and it makes the woodpecker yaml file unnecessarily bloated...

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

No branches or pull requests

4 participants