 API key, run:

...

Set up your secrets in GithubFor our Github Actions we will need to set up some secrets for our repository. Specifically, you should use github secrets to store the ZENML_API_KEY that you created above.

The other values that are loaded from secrets into the environment here can also be set explicitly or as variables.

(Optional) Set up different stacks for Staging and Production

You might not necessarily want to use the same stack with the same resources for your staging and production use.

This step is optional, all you'll need for certain is a stack that runs remotely (remote orchestration and artifact storage). The rest is up to you. You might for example want to parametrize your pipeline to use different data sources for the respective environments. You can also use different configuration files for the different environments to configure the Model, the DockerSettings, the ResourceSettings like accelerators differently for the different environments.

Trigger a pipeline on a Pull Request (Merge Request)

One way to ensure only fully working code makes it into production, you should use a staging environment to test all the changes made to your code base and verify they work as intended. To do so automatically you should set up a github action workflow that runs your pipeline for you when you make changes to it. Here is an example that you can use.

To only run the Github Action on a PR, you can configure the yaml like this

on:

pull_request:

branches: [ staging, main ]

When the workflow starts we want to set some important values. Here is a simplified version that you can use.

jobs:

run-staging-workflow:

runs-on: run-zenml-pipeline

env:

ZENML_HOST: ${{ secrets.ZENML_HOST }}  # Put your server url here

ZENML_API_KEY: ${{ secrets.ZENML_API_KEY }}  # Retrieves the api key for use

ZENML_STACK: stack_name  #  Use this to decide which stack is used for staging

ZENML_GITHUB_SHA: ${{ github.event.pull_request.head.sha }}