Run the ingestion from GitHub Actions
The process to run the ingestion from GitHub Actions is the same as running it from anywhere else.- Get the YAML configuration,
- Prepare the Python Script
- Schedule the Ingestion
1. YAML Configuration
For any connector and workflow, you can pick it up from its doc page.2. Prepare the Python Script
In the GitHub Action we will just be triggering a custom Python script. This script will:- Load the secrets from environment variables (we don’t want any security risks!),
- Prepare the Workflow class from the Ingestion Framework that contains all the logic on how to run the metadata ingestion,
- Execute the workflow and log the results.
- A simplified version of such script looks like follows:
os.getenv.
3. Schedule the Ingestion
Now that we have all the ingredients, we just need to build a simple GitHub Actions with the following steps:- Install Python
- Prepare virtual environment with the openmetadata-ingestion package
- Run the script!
- It is as simple as this. Internally the function run we created will be sending the results to the OpenMetadata server, so there’s nothing else we need to do here.
[Optional] - Getting Alerts in Slack
A very interesting option that GitHub Actions provide is the ability to get alerts in Slack after our action fails. This can become specially useful if we want to be notified when our metadata ingestion is not working as expected. We can use the same setup as above with a couple of slight changes:- Marked the
Run Ingestionstep with a specificidand withcontinue-on-error: true. If anything happens, we don’t want the action to stop. - We added a step with
slackapi/[email protected]. By passing a Slack Webhook link via a secret, we can send any payload to a - specific Slack channel. You can find more info on how to set up a Slack Webhook here.
- If our
ingestionstep fails, we still want to mark the action as failed, so we are forcing the failure we skipped before.