Skip to content

Add privateKey property to the AbstractGitTask to support SSH key-based authentication for all Git tasks #172

@smooth-baking-powder

Description

@smooth-baking-powder

Describe the issue

This Flow not work with the WorkingDirectory inputFiles. Before i used the deprecated LocalFiles and it worked fine.

id: dev-test
namespace: dev

tasks:
  - id: start
    type: io.kestra.plugin.core.flow.WorkingDirectory
    inputFiles:
      id_rsa: "test"


    tasks:
      - id: clone_repository
        type: io.kestra.plugin.git.SyncNamespaceFiles
        namespace: prod
        gitDirectory: _files # optional; set to _files by default
        delete: false # optional; by default, it's set to false to avoid destructive behavior
        url: "{{ globals['repository-url'] }}"
        branch: "{{ globals['repository-branch'] }}"
        username: "{{ globals['repository-username'] }}"
        password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
        dryRun: true

Log:

2024-06-07T06:40:15.026Z INFO Provided 1 input(s).
2024-06-07T06:40:16.187Z INFO Start cloning from 'https://gitlab.xy.xy/xy/xy'
2024-06-07T06:40:16.204Z ERROR Destination path "spgOiPTaewpXqQS8vgGL0" already exists and is not an empty directory

image

If i use the old "LocalFiles" it works:

id: dev-test
namespace: dev

tasks:
  - id: start
    type: io.kestra.plugin.core.flow.WorkingDirectory

    tasks:
      - id: clone_repository
        type: io.kestra.plugin.git.SyncNamespaceFiles
        namespace: prod
        gitDirectory: _files # optional; set to _files by default
        delete: false # optional; by default, it's set to false to avoid destructive behavior
        url: "{{ globals['repository-url'] }}"
        branch: "{{ globals['repository-branch'] }}"
        username: "{{ globals['repository-username'] }}"
        password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
        dryRun: true
      
      - id: load_ssh_key
        type: io.kestra.core.tasks.storages.LocalFiles
        inputs:
          id_rsa: "{{ secret('SSH_KEY') }}"

Log:

2024-06-07T06:43:30.430Z INFO Start cloning from 'https://gitlab.c-lab.one/c-lab/automatisierung'
2024-06-07T06:43:31.851Z INFO Provided 1 input(s).
2024-06-07T06:43:31.857Z INFO Captured 0 output(s).

image

Environment

  • Kestra Version: 0.17.1
  • Operating System (OS/Docker/Kubernetes): Debian/Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/pluginPlugin-related issue or feature requestgood first issueGreat issue for new contributors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions