I had made the following YAML pipeline on Azure Pipelines, that will run two jobs, using a list of specific parameters, depending on the schedule that I had set.
Here's a tweaked (not the original) code snippet of what I had made. Though it hasn't been run by schedule yet, the original code does work when I run it manually.
#./azure-pipelines.yml
trigger: none
# Based on the name of the schedule, the assigned parameter will be called.
schedules:
- cron: "0 17 * * Fri"
displayName: Weekly Run
branches:
include:
- main
always: true
- cron: "0 17 /15 * Fri"
displayName: Bi-Weekly Run
branches:
include:
- main
always: true
batch: true # Pipeline will run even when an older scheduled pipeline is running as well
pool: windows-latest
parameters:
- name: weeklyList
type: object
default:
- "apple"
- "watermelon"
- name: biWeeklyList
type: object
default:
- "orange"
- "melon"
jobs:
- job : Weekly_Run
${{ if ne(variables['Build.Reason'], 'Manual') }}:
condition: eq(variables['Build.CronSchedule.DisplayName'], 'Weekly Run')
steps:
- ${{ each fruit in parameters.weeklyList }}:
- script: echo ${{ fruit }}
- job : Bi_Weekly_Run
${{ if ne(variables['Build.Reason'], 'Manual') }}:
condition: eq(variables['Build.CronSchedule.DisplayName'], 'Bi-Weekly Run')
steps:
- ${{ each fruit in parameters.biWeeklyList}}:
- script: echo ${{ fruit }}
For monitoring sake, I'd like to have two pipelines, one will have only a list of weekly runs and and the other is a list of biweekly runs. For example's sake, let's call them Pipeline-Weekly and Pipeline-BiWeekly.
Is it possible to have Pipeline-Weekly and Pipeline-BiWeekly referencing to the same YAML file, i.e. azure-pipelines.yml, but show the jobs they're intended for monitoring?
How do I set that? It seemed like the answer by Levi Lu-MSFT in https://stackoverflow.com/a/64656297/6681261 is pointing in this direction, but it also looks to me that that's a separate YAML (which I'm trying to avoid, unless it's necessary), but it "overrides" the parameter.