Skip to content

Trigger via a commit

Create a GitHub repository

  • Visit your github account home page and create a new public repository
  • Clone your repository locally
  • Author a simple text file (perhaps a README file) and add it to the repository
  • Commit and push your changes

Example pipeline

Use the example file git-triggered.yml as a starting point.

Revise the file as follows:

  • Modify the resource to represent the repository you just created
  • Rename the resource accordingly to reflect that it represents your particular repository
  • Revise the job to get the resource you defined
  • Modify the args value to list the contents of the current directory recursively (ls -R)

When satisfied with your changes, set the pipeline, and unpause it.

The job will self-trigger.

Why does the job self-trigger?

The job is defined to be triggered by changes to the git repository. When the pipeline is set, fetching the resource triggers the job.

Watch the first build as it executes.

Now make a new commit: add a second file alongside the first one, and push your changes.

Watch as the repository update triggers a new build to run within the resolution of the Concourse polling interval (1m).

In the Concourse dashboard, expand the get step and review the commit that triggered the run.

Info

The Concourse git resource type concourse/git-resource together with commit-triggered jobs are one of the most typical scenarios in Continuous Integration (CI). This is what most development teams rely on to trigger their pipelines, to run a build to ensure that the software project remains "green" (that no regressions are introduced).