Skip to content

Configure the workflow

This section describes how to notify your infrastructure repository about an updated container image from the application repository.

Given this configuration, you should achieve the following outcome in the workflow file after completing this page:

Configuration
Environment pirates-dev
IacGitHubRepo pirates-iac
Outcome in jobs.dispatch.steps
with.repository oslokommune/pirates-iac
with.event_type pirates-dev-too-tikki-image-tag-update
env.RECEIVER_WORKFLOW _gp_too-tikki_pirates-dev_receive_dispatch_event.yml

Step 1: Enable dispatch

To enable dispatch, you need to add the following lines to the build-push.yml configuration file in the application repository.

repo-apps/.github/workflows/environments/dev/app-too-tikki/build-push.yml
AppName: too-tikki
Dispatch:
+ Enable: true
+ IacGitHubRepo: pirates-iac

The Enable flag is used to enable the dispatch event.

The IacGitHubRepo is the name of the repository where the dispatch event will be sent, this must be within the oslokommune organization in GitHub.

Step 2: Update the build-push template

Run the following command to update the template after updating the configuration file

repo-apps/.github/workflows/environments/dev/app-too-tikki
boilerplate \
  --template-url "git@github.com:oslokommune/golden-path-boilerplate.git//boilerplate/github-actions/docker-build-push/?ref=main" \
  --var-file build-push.yml \
  --var-file ../common-config.yml \
  --output-folder ../../../ \
  --non-interactive

Step 3: Verify the outcome

The workflow file .github/workflows/_gp_too-tikki_pirates-dev_build_and_push_image.yml should now have a jobs.dispatch job that sends an event to the infrastructure repository.

The outcomes as listed in the above table should be present in the jobs.dispatch.steps section of the workflow file.

The values of event_type and RECEIVER_WORKFLOW will be used in the receiving infrastructure repository to target the correct workflow.

Commit your files

At this stage it is a good idea to commit your files.

Step 4: Try to run the workflow

Try running the workflow. It will fail because the workflow tries to send a "dispatch event" to your infrastructure repository without the proper authentication. To resolve this, you need to set up a Personal Access Token (PAT).

Next step

Create a Personal Access Token.