Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Add logic to generate Renovate postUpgradeTasks #62

Merged
merged 3 commits into from
Mar 21, 2022

Conversation

simu
Copy link
Member

@simu simu commented Mar 17, 2022

Until now, the test matrix has been defined in a local variable for the .github/workflows/test.yaml template. To allow us to generate Renovate postUpgradeTasks and a list of test instances in a make variable, we need to be able to access the matrix test configuration in other templates.

This PR moves the test matrix configuration to global variable testMatrix. For now, the GitHub actions template will continue to read the test matrix from the file-level variable matrix, but will fall back to the global variable testMatrix if the file-level variable is missing.

Additionally, the PR adds new make targets golden-diff-all and gen-golden-all. These targets use a static list of test instances in make variable test_instances. The contents of this variable are generated from the modulesync parameter testMatrix.entries.

We use a generic recursive make target based on the test_instances make variable to implement the new targets. This allows us to reuse the existing golden-diff and gen-golden targets.

The new targets are only added for components which have matrix tests configured and which have migrated their matrix test configuration to modulesync parameter testMatrix.

Finally, this PR adds logic to generate section postUpgradeTasks in renovate.json for components
which have golden tests enabled. To determine the command to execute, we check if the component has matrix tests configured (based on parameter testMatrix). We use the make gen-golden-all as the command for components with matrix tests and make gen-golden for other components.

Commodore component-template PR: projectsyn/commodore#424

Checklist

  • The component template has a PR open that syncs the changes with this one.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Link this PR to related issues.

@simu simu added the enhancement New feature or request label Mar 17, 2022
simu added a commit to projectsyn/commodore that referenced this pull request Mar 18, 2022
This commit adjusts the initial modulesync config generated by the
component template to match the changes introduced by
projectsyn/modulesync-control#62 which
facilitate keeping the Renovate `postUpgradeTasks` updated when new
matrix tests are added.
@simu simu force-pushed the feat/renovate-postupgrade-tasks branch from 7546223 to c712142 Compare March 18, 2022 10:52
simu added a commit to projectsyn/commodore that referenced this pull request Mar 18, 2022
This commit adjusts the initial modulesync config generated by the
component template to match the changes introduced by
projectsyn/modulesync-control#62 which
facilitate keeping the Renovate `postUpgradeTasks` updated when new
matrix tests are added.
@simu simu force-pushed the feat/renovate-postupgrade-tasks branch from c712142 to 7da8104 Compare March 18, 2022 14:05
@simu simu marked this pull request as ready for review March 18, 2022 14:16
@simu simu requested review from bastjan and glrf March 18, 2022 14:16
simu added a commit to projectsyn/commodore that referenced this pull request Mar 18, 2022
This commit adjusts the initial modulesync config generated by the
component template to match the changes introduced by
projectsyn/modulesync-control#62 which
facilitate keeping the Renovate `postUpgradeTasks` updated when new
matrix tests are added.
Copy link
Contributor

@bastjan bastjan left a comment

Choose a reason for hiding this comment

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

Maybe we could track the test targets in the Makefile too?

Something like make gen-golden-all would speed up the workflow considerably for some components. Bonus: Less complicated json rendering for renovate tasks.

Copy link
Contributor

@glrf glrf left a comment

Choose a reason for hiding this comment

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

LGTM

@simu
Copy link
Member Author

simu commented Mar 18, 2022

Something like make gen-golden-all would speed up the workflow considerably for some components. Bonus: Less complicated json rendering for renovate tasks.

I actually already implemented this for a component at some point, but forgot about it until you mentioned it. I'll redo the PR to implement the gen-golden-all and golden-diff-all targets for all components and use gen-golden-all for the postUpgradeTasks.

Until now, the test matrix has been defined in a local variable for the
`.github/workflows/test.yaml` template. In preparation for generating
Renovate `postUpgradeTasks` and a list of test instances in a make
variable, we need to be able to access the matrix test configuration in
other templates.

This commit moves the test matrix configuration to global variable
`testMatrix`. For now, the GitHub actions template will continue to read
the test matrix from the file-level variable `matrix`, but will fall
back to the global variable `testMatrix` if the file-level variable is
missing.

All already onboarded components should migrate their test matrix (if
any) to global parameter `testMatrix`.
@simu simu force-pushed the feat/renovate-postupgrade-tasks branch 3 times, most recently from 808fddf to 77a146b Compare March 18, 2022 15:21
simu added a commit to projectsyn/commodore that referenced this pull request Mar 18, 2022
This commit adjusts the initial modulesync config generated by the
component template to match the changes introduced by
projectsyn/modulesync-control#62 which
facilitate keeping the Renovate `postUpgradeTasks` updated when new
matrix tests are added.
@simu simu requested a review from bastjan March 18, 2022 16:13
simu added 2 commits March 21, 2022 10:45
These targets use a static list of test instances in make variable
`test_instances`. The contents of this variable are generated from the
modulesync parameter `testMatrix.entries`.

We use a generic recursive make target based on the `test_instances`
make variable to implement the new targets. This allows us to reuse the
existing `golden-diff` and `gen-golden` targets.

The new targets are only added for components which have golden and
matrix tests configured and which have migrated their matrix test
configuration to modulesync parameter `testMatrix`.
We generate section `postUpgradeTasks` in `renovate.json` for components
which have golden tests enabled. To determine the command to execute, we
check if the component has matrix tests configured (based on parameter
`testMatrix`). We use the `make gen-golden-all` as the command for
components with matrix tests and `make gen-golden` for other components.
@simu simu force-pushed the feat/renovate-postupgrade-tasks branch from 77a146b to 40f563c Compare March 21, 2022 09:45
@simu simu merged commit 495fd4d into master Mar 21, 2022
@simu simu deleted the feat/renovate-postupgrade-tasks branch March 21, 2022 16:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants