cli icon indicating copy to clipboard operation
cli copied to clipboard

integrate git ref parameter for git source for task defintion in bundle

Open PaulMaksud opened this issue 1 year ago • 1 comments

Hello, for the moment we can only select git_branch or git_tag for git_source in task definition, we are having a hard time doing a conditional switch in our bundle between environment because we want to use git_branch in dev environment and git_tag in upper env triggered by ci/cd. Would it be possible to have a git_ref option that can integrate both tag and branch as valid source.

PaulMaksud avatar Aug 23 '23 10:08 PaulMaksud

Would be amazing ! The same behavior as GitHub API would make sense.

Paul-AUB avatar Aug 23 '23 11:08 Paul-AUB

Agreed, this definitely would be a really nice feature to have within the bundle configuration.

In the meantime, I did come up with a solution using complex variables. I think native support for this would be a little neater but its not a terrible work around.

# bundle.yaml
bundle:
  name: Demo for dynanic github ref type in bundle
  git:
    origin_url: [insert gh repo url here]

variables:
  git_provider:
    default: [github provider here]
  git_source:
    type: complex

resources:
  jobs:
    mini_job:
      name: mini job
      tasks:
        - task_key: task1
          notebook_task:
            notebook_path: test_notebook
            source: GIT
      git_source: ${var.git_source}

targets:
  git_branch_target:
    default: true
    variables:
      git_source:
        type: complex
        default: 
          git_url: ${bundle.git.origin_url}
          git_provider: ${var.git_provider}
          git_branch: [branch name or ${bundle.git.branch}]
  
  git_tag_target:
    variables:
      git_source:
        type: complex
        default: 
          git_url: ${bundle.git.origin_url}
          git_provider: ${var.git_provider}
          git_tag: [git tag to use]

amichaelsen avatar Oct 25 '24 18:10 amichaelsen