navicore / teams-notification-resource

for Concourse CI notifications on Microsoft Teams
MIT License
32 stars 33 forks source link

actionTarget for pipelines set via instance_vars #24

Open aaron-uk opened 2 years ago

aaron-uk commented 2 years ago

It is possible to update the actionTarget to cater for Concourse instanced/grouping pipelines workflows, see more here: https://concourse-ci.org/multi-branch-workflows.html & https://concourse-ci.org/instanced-pipelines.html

This is what a demonstration of a URL looks like and they are autogenerated via a configuration pipeline, where the instance_vars can be different.

$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$SET_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/3?vars.branch=%22release/2.3.x%22&vars.pipeline=%fooBar%22

$SET_PIPELINE_NAME = fooBar-releases (name of set_pipeline in job below.)

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

resources:
  -  name: source-code
      type: git-branches
      icon: git
      source:
        uri: ((source_code_git_repo_ssh_uri))
        branch_regex: release/(?P<version>\d+.\d+).x # Match any branch with release/* and saves first two numbers to version e.g. 2.3.
        private_key: ((git.private-key))

jobs:
  - name: reconfigure-fooBar-release
    plan:
    - get: source-code
        trigger: true
    - load_var: branches
      file: source-code/branches.json
    - across:
        - var: branch
          values: ((.:branches))
      set_pipeline: fooBar-releases
      file: ci/pipelines/templates/golang.yml
      instance_vars:
        branch: ((.:branch.name))
        pipeline: fooBar
      var_files:
        - ci/parameters/projects/fooBar.yml

Is there a way to add this workflow into this Concourse resource?

Many thanks and kind regards, Aaron

navicore commented 2 years ago

It should be possible - seems like a good thing to add.

I'll look closer and refresh my memory about how the vars are resolved and what's available.... will have to make my QA env exercise instanced/grouping...