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 |
IacGitHubOrg | oslokommune |
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 too-tikki_docker-build-push.yml
configuration file in the application repository.
AppName: too-tikki
Dispatch:
+ Enable: true
+ IacGitHubRepo: pirates-iac
+ IacGitHubOrg: oslokommune
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 organization configured by IacGitHubOrg
.
Step 2: Update the docker-build-push
package
Run the following command to update the package:
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).