-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Is it possible to trigger a concourse pipeline using this resource without doing a get
or a clone?
The use case is that we need to run some code once a month on a cron schedule, and also run that same code whenever a PR with a given label is merged. When a PR with a given label is merged, we don't need to clone that PR branch or interact with that PR at all. We only want the PR to trigger a job, but other than that we don't test anything in the PR or use the PR branch at all.
Currently we do it like this:
resource_types:
- name: cron-resource
type: docker-image
source:
repository: cftoolsmiths/cron-resource
- name: pull-request
type: docker-image
source:
repository: cfcommunity/github-pr-resource
tag: "0.25.2"
resources:
- name: devops
type: git
icon: github
source:
branch: master
uri: [email protected]:company/devops.git
private_key: ((github_deploy_private_key))
- name: merged-offboarding-pull-request
type: pull-request
check_every: 2m
source:
repository: company/devops
access_token: ((github_api_token))
paths:
- some_file_from_the_latest_pr.txt
base_branch: master
states:
- MERGED
labels:
- STAFF-OFFBOARDING
- name: monthly
type: cron-resource
icon: calendar
source:
expression: "0 13 01 * *" # 1PM on the first day of the month
location: "America/New_York"
jobs:
- name: some-job
plan:
- get: devops
# Trigger the job monthly
- get: monthly
trigger: true
# OR when an offboarding PR is merged
- get: merged-offboarding-pull-request
trigger: true
- task: some-job
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
tag: 24.04
inputs:
- name: devops # Notice that there is no input for the PR branch, we don't use the PR branch at all other than as a trigger
run:
dir: devops
path: ./some_script.sh
The above does work most of the time. But currently we found ourselves in a state where the get
step of the PR fails because of a merge conflict:
Initialized empty Git repository in /tmp/build/get/.git/
Switched to a new branch 'master'
Auto-merging some_file_from_the_latest_pr.txt
CONFLICT (content): Merge conflict in some_file_from_the_latest_pr.txt
Automatic merge failed; fix conflicts and then commit the result.
2025/06/05 14:09:25 get failed: merge failed: exit status 1
I can probably work around this by pushing a new PR which doesn't conflict with master, but since our use case doesn't use the PR branch at all, is it possible to use a PR as a trigger without get
'ing or cloning the PR branch at all?
Thanks.