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

Why is the "branch" parameter defined in the source field and not defined as mandatory in the "param" field? #422

Open
bheemann opened this issue Jan 26, 2024 · 0 comments

Comments

@bheemann
Copy link

Is your feature request related to a problem? Please describe.

I have a multibranch pipeline like this:

resource_types:
  - name: git-branches
    type: registry-image
    source:
      repository: aoldershaw/git-branches-resource

resources:
  - name: issue-branches
    type: git-branches
    source:
      uri: <uri>
      password: <user>
      username: <pw>
      branch_regex: 'Foo-(?P<issue>.*)'

  - name: project
    type: git
    source:
      uri: <uri>
      password: <user>
      username: <pw>
      fetch_tags: true


jobs:
  - name: set-issue-pipelines
    plan:
    - get: issue-branches
      trigger: true # creates pipeline for new branch      
    - get: project
    - load_var: branches
      file: issue-branches/branches.json
    - across:
      - var: branch
        values: ((.:branches))
      do:
      - get: semver-repo 
      - task: create-initial-version-file
        file: project/pipelines/tasks/create-initial-release-version.yml
        vars:
          branch: ((.:branch.name))
      - put: semver-repo
        params:
          repository: semver-repo
      - set_pipeline: issues-tests
        file: project/pipelines/branch_pipeline.yml
        instance_vars: {issue: ((.:branch.groups.issue))}
        vars: 
          branch: ((.:branch.name))
          version_bump_style: {pre: ((.:branch.name))}
          pre_release: true

At the moment I can only use the same branch template for every pipeline created via set_pipeline.

Describe the solution you'd like

What i would like to do:

resource_types:
  - name: git-branches
    type: registry-image
    source:
      repository: aoldershaw/git-branches-resource

resources:
  - name: issue-branches
    type: git-branches
    source:
      uri: <uri>
      password: <user>
      username: <pw>
      branch_regex: 'Foo-(?P<issue>.*)'

  - name: project
    type: git
    source:
      uri: <uri>
      password: <user>
      username: <pw>
      fetch_tags: true



jobs:
  - name: set-issue-pipelines
    plan:
    - get: issue-branches
      trigger: true # creates pipeline for new branch       
    - load_var: branches
      file: issue-branches/branches.json
    - across:
      - var: branch
        values: ((.:branches))
      do:
      - get: semver-repo 
      - get: project
        branch: ((.:branch.name))          <-- NOT POSSIBLE BUT DESIRED AS NEW FEATURE
      - task: create-initial-version-file
        file: project/pipelines/tasks/create-initial-release-version.yml
        vars:
          branch: ((.:branch.name))
      - put: semver-repo
        params:
          repository: semver-repo
      - set_pipeline: issues-tests
        file: project/pipelines/branch_pipeline.yml
        instance_vars: {issue: ((.:branch.groups.issue))}
        vars: 
          branch: ((.:branch.name))
          version_bump_style: {pre: ((.:branch.name))}
          pre_release: true

Describe alternatives you've considered

I can't think of any alternatives that aren't very complex at the same time, although the proposed solution seems so elegant to me?

However, there must be something that I am overlooking as to why it is not already implemented in this way, or am I the only one with this requirement?

Additional context

I am happy to receive suggestions, ideas or tips.

Happy coding!

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

No branches or pull requests

1 participant