<@ULVA73B9P> is there a way to use github actions ...
# ask-marvin
a
@Marvin is there a way to use github actions to populate the branch in deployment.yaml
m
The information available in the Prefect release notes mentions the Deploy a Prefect Flow GitHub Action, which allows for automating the build process for deployments orchestrated by Prefect Cloud. This action leverages the new Projects system. Although the excerpt from the release notes doesn't provide specific details on populating the branch in the
deployment.yaml
, it suggests that such automation is possible with GitHub Actions. For detailed examples and configuration options, you should refer to the action page on GitHub Marketplace. Typically, GitHub Actions allows you to set environmental variables or modify files using scripting within the GitHub Action workflow. You might be able to use these features to populate the branch name dynamically in your
deployment.yaml
. If you would like more specific guidance, I recommend checking the documentation or examples provided in the GitHub Action page or in the official Prefect documentation for GitHub Actions integrations. If this doesn't fully answer your question, or if you require further assistance with GitHub Actions and Prefect, please let me know, and I can assist you further.
n
hi @Ax - do you mean
deployment.yaml
or
prefect.yaml
?
a
you're right, I mean
prefect.yaml
Essentially want to use a github action to populate the branch name on all deployments named staging – rather than merging them to a staging branch
n
Essentially want to use a github action to populate the branch name on all deployments named staging
hmm can you explain this a bit more? do you mean like deployments named like
staging-*
should all have the same
branch
in their
pull
step?
a
Sure thing, below is my
prefect.yaml
At the moment, everything pulls for main.
Copy code
name: deployments

pull:
  - prefect.deployments.steps.git_clone:
      repository: <https://github.com/my_github_repo.git>
      branch: main
      access_token: '{{ prefect.blocks.secret.dna-infrastructure-key }}'

deployments:
  - name: production
    version:
    tags: []
    description:
    entrypoint: orchestration/prefect/flows/predictor.py:predictor_flow
    parameters:
      bucket: mlops-sagemaker-production
      model_package_group_name: production-predictor
      endpoint_name: production-predictor
    work_pool:
      name: ecs-pool
      work_queue_name:
      job_variables: {}
    schedule:
      cron: 0 7 13 * *
      timezone: Europe/London

  - name: staging
    version:
    tags: []
    description:
    entrypoint: orchestration/prefect/flows/predictor.py:predictor_flow
    parameters:
      bucket: mlops-sagemaker-staging
      model_package_group_name: staging-predictor
      endpoint_name: staging-predictor
    work_pool:
      name: ecs-pool
      work_queue_name:
      job_variables: {}
    schedule:
      cron: 0 7 13 * *
      timezone: Europe/London
In the event of a PR getting approved: • get branch of the PR • Update the Prefect.yaml with that branch for all flows that begin with staging • Deploy all staging deployments • Run all staging deployments Basically is there a way of dynamically populating the branch into the yaml file for staging deployments and then deploying these?