Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add document for using task migrations #1862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tkdchen
Copy link
Contributor

@tkdchen tkdchen commented Jan 27, 2025

@tkdchen tkdchen requested a review from a team as a code owner January 27, 2025 09:12
Historically, task maintainers write `MIGRATION.md` to notify users what changes
have to be made to the pipeline. This mechanism is not deprecated. Besides
writing the file, it is also recommended to write a migration so that the
updates can be applied to user pipelines automatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would also be good to mention how the migration files get applied - i.e. link to the migration tool and the configuration that enables it in our Renovate deployment (Mintmaker)


Historically, task maintainers write `MIGRATION.md` to notify users what changes
have to be made to the pipeline. This mechanism is not deprecated. Besides
writing the file, it is also recommended to write a migration so that the
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
writing the file, it is also recommended to write a migration so that the
writing the document, it is also recommended to write a script so that the


The migration file is a normal Bash script file. It should

- Accept one argument. The pipeline file path is passed to via this argument.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also mention that this pipeline file is always a tekton Pipeline file. Even if the pipeline is defined inline in a PipelineRun file, the migration tool extracts the Pipeline from it and calls the migration script on the Pipeline.

This also means it's not possible to apply changes that would have to be done on the PipelineRun, e.g. changing the volumeClaimTemplate for a workspace or things like that

- Be simple and small as much as possible.
- Pass the `shellcheck` without customizing the default rules.

Here are example script to create a migration for a task `task-a`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Here are example script to create a migration for a task `task-a`:
Here are example steps to create a migration for a task `task-a`:

Comment on lines +260 to +261
(.spec.tasks[] | select(.name == "task-a") | .params) +=
{"name": "pipelinerun-name", "value": "\$(context.pipelineRun.name)"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make this example idempotent? (I.e. only add the param if it's not already there)

@chmeliik
Copy link
Contributor

We should probably keep this open until the migration tool is ready for use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants