Skip to content

build-cd v7: !update-configs: Prerelease to Model Configs Pipeline#321

Merged
CodeGat merged 17 commits intov7from
prerelease-to-model-configs-pipeline
Dec 18, 2025
Merged

build-cd v7: !update-configs: Prerelease to Model Configs Pipeline#321
CodeGat merged 17 commits intov7from
prerelease-to-model-configs-pipeline

Conversation

@CodeGat
Copy link
Copy Markdown
Member

@CodeGat CodeGat commented Sep 29, 2025

Closes #320

Important

This PR is a major update to the deployment infrastructure. See below for the prerequisites for this repository to be able to merge this PR.

Background

There is still a bit of human overhead when opening Model Configs PRs based on new Prerelease builds.

In this PR, we allow for a new command for Model Deployment Repositories, one of the form:

!update-configs [profile=PROFILE]
# !update-configs  # This is the same as !update-configs profile=default
# !update-configs profile=qa-only

This command will open PRs in a linked model configs repository based on a given profile. A profile is a set of configuration branches to create PRs from, defined in an MDRs config/auto-configs-pr.json file. This file is sourced from the MDR branch, not the default one, meaning users can make modifications in the prerelease PR as they see fit.

This file looks something like:

{
  "$schema": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/deployment/config/auto-configs-pr/1-0-0.json",
  "profiles": {

    "default": {
      "configs_repo": "ACCESS-NRI/access-test-configs",
      "configs": {
        "dev-01deg_jra55_iaf": {
          "checks": {
            "repro": true
          }
        },
        "dev-01deg_jra55_ryf": {
          "checks": {
            "repro": false
          }
        }
      }
    },

    "qa-only": {
      "configs_repo": "ACCESS-NRI/access-test-configs",
      "configs": {
        "dev-01deg_jra55_iaf": {
          "checks": {
            "repro": false
          }
        },
        "dev-01deg_jra55_ryf": {
          "checks": {
            "repro": false
          }
        }
      }
    }
  }
}

and specifies a profile name, a configs repository to source configs from, and a list of configs to generate PRs from. Furthermore, it will run the given checks on the new PR - for example, !test repro.

The PR

  • Custom-action-ify the code for getting the number of deployments a MDR PR has had
  • Reference the above new action in ci.yml
  • Add a new workflow, ci-command-configs.yml, that handles the new !update-configs command

Testing

Testing of the syntax and outputs of the command was done in ACCESS-NRI/ACCESS-TEST#56

Note

The linked opened PRs are for access-test-configs, which is a repository that isn't yet setup for actual QA/repro tests, which is why they failed. This commands scope ends at the point where a PR is opened in a configs repository (and optionally runs !test repro in a configs repo.

Unit Tests were done via pytest

Known Limitations

  • If !update-configs is run twice on the same prerelease build, it will throw an error about a PR already existing for that configuration branch. In future, we will add commits to the existing PR instead.
  • If the commenter has write permissions on the MDR, they will be able to do !update-configs and by proxy open auto PRs into the linked configs repository. More testing needs to be done with this.

MDR Requirements for Merging

  • MDRs wanting to make use of this feature must have a secrets.CONFIGS_REPO_TOKEN that is passed into the entrypoint secrets.configs-repo-token. This token must have pull-requests:write, contents:write for all configs repositories defined in config/auto-configs-pr.json. Speaking of...
  • MDRs want to make use of this feature must also have a config/auto-configs-pr.json file in their MDR (either in the PR they want to use the command, or in the default branch. This contains configuration information for the command.

@CodeGat CodeGat self-assigned this Sep 29, 2025
@CodeGat CodeGat added type:feature New feature priority:medium version:MAJOR Requires an update to Model Deployment Repositories CI for:v7 Applies to v7 labels Sep 29, 2025
@CodeGat CodeGat marked this pull request as ready for review September 29, 2025 06:15
@CodeGat CodeGat changed the base branch from v6 to v7 September 30, 2025 23:00
@CodeGat CodeGat linked an issue Oct 1, 2025 that may be closed by this pull request
@CodeGat CodeGat changed the title !update-configs: Prerelease to Model Configs Pipeline build-cd v7: !update-configs: Prerelease to Model Configs Pipeline Oct 30, 2025
@aidanheerdegen aidanheerdegen self-requested a review November 7, 2025 04:38
@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch from beaa740 to 8ae2854 Compare November 27, 2025 01:06
@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch from 8ae2854 to 4fc262d Compare November 27, 2025 02:41
Copy link
Copy Markdown
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will probably have to do a pair-review at some stage, but I have some preliminary comments.

@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch 3 times, most recently from ba8c62b to e844b47 Compare December 17, 2025 02:33
@CodeGat
Copy link
Copy Markdown
Member Author

CodeGat commented Dec 17, 2025

Hey @dougiesquire - just getting back to this !update-configs command - how do you find the structure of the file for config/auto-configs-pr.json (under the Background section in the PR description)?

@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch 5 times, most recently from e0adb9d to a06c2ac Compare December 18, 2025 00:18
@CodeGat CodeGat marked this pull request as draft December 18, 2025 00:19
@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch from a06c2ac to 467bedb Compare December 18, 2025 00:23
@CodeGat CodeGat marked this pull request as ready for review December 18, 2025 00:30
@CodeGat CodeGat force-pushed the prerelease-to-model-configs-pipeline branch from 467bedb to 597ccde Compare December 18, 2025 00:31
@CodeGat
Copy link
Copy Markdown
Member Author

CodeGat commented Dec 18, 2025

Whew, after a lot of testing I've got the matrixed jobs working @aidanheerdegen!

Here are the two tests done to verify it works:

Copy link
Copy Markdown
Contributor

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dougiesquire - just getting back to this !update-configs command - how do you find the structure of the file for config/auto-configs-pr.json (under the Background section in the PR description)?

Looks great @CodeGat thanks. This would work particularly nicely if the repro check github comment reflected the pytest markers, so one could have e.g.

  "profiles": {

    "default": {
      "configs_repo": "ACCESS-NRI/access-test-configs",
      "configs": {
        "dev-01deg_jra55_iaf": {
          "checks": {
            "repro": true                <<< run all repro tests
          }
        },
        "dev-01deg_jra55_ryf": {
          "checks": {
            "repro_historical": false    <<< run historical repro tests
          }
        }
      }
    }
  }

But that is a separate issue (there are other, possibly better, solutions to this in this issue).

@CodeGat
Copy link
Copy Markdown
Member Author

CodeGat commented Dec 18, 2025

Gotcha - I'd always treated the repro bit as an overall type of tests (other future examples would be a performance type of tests) that has test markers within it! In the linked issue it seems like it'd be a preference to just go via markers entirely with no notion of an overall suite of tests, which is valid as well.

The linked issue would be good to sort out - but that will probably come later.

I wonder if the repro suite of tests could be boolean or a string of markers...I've added the hypothetical suite of tests performance just to illustrate:

  "profiles": {

    "default": {
      "configs_repo": "ACCESS-NRI/access-test-configs",
      "configs": {
        "dev-01deg_jra55_iaf": {
          "checks": {
            "repro": true  # run the default repro suite of tests (informed by the configs ci.json file)
            "performance": true  # run the default performance suite of tests (informed by the configs ci.json file)
          }
        },
        "dev-01deg_jra55_ryf": {
          "checks": {
            "repro": "repro_historical and not slow" # run these specific markers for the repro suite of tests
            "performance": "blah and not slow" # run these specific markers for the performance suite of tests
          }
        },
        "dev-01deg_jra55_abc": {
          "checks": {
            "repro": false # don't run the repro suite of tests at all
            "performance": false # don't run the performance suite of tests at all
          }
        }
      }
    }
  }

In the case you noted, rather than suites of tests, it would be a list of pytest markers, I suppose. But yeah, I think that can come later, since we need to get the v7 stuff off the ground so we can migrate to spack v1!

Copy link
Copy Markdown
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But note I have not checked the python code carefully. I can do it, but don't currently have the time. If you need a thorough check might have to rope in someone else, but I am happy to proceed if you are.

@aidanheerdegen
Copy link
Copy Markdown
Member

It is much cleaner with the matrix approach, even if it does mean more CI steps. Also means we could move to multiple config repos fairly easily, as it is just a bigger matrix.

@CodeGat CodeGat merged commit 046e964 into v7 Dec 18, 2025
3 checks passed
@CodeGat CodeGat deleted the prerelease-to-model-configs-pipeline branch December 18, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

for:v7 Applies to v7 priority:medium type:feature New feature version:MAJOR Requires an update to Model Deployment Repositories CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prerelease into Configs PR Comment Command

3 participants