Skip to content

Commit 79b5323

Browse files
committed
Update SHARED-CI.md for task migrations according to ADR 54
STONEBLD-3903 According to ADR #54 Start versioning Tekton Tasks responsibly, task maintainers will not create MIGRATION.md for task changes and will maintain task in a new directory layout. This commit updates task migrations related part in SHARED-CI.md. MIGRATION.md is removed from the example task hello. Signed-off-by: Chenxiong Qi <[email protected]>
1 parent b26910a commit 79b5323

File tree

4 files changed

+46
-42
lines changed

4 files changed

+46
-42
lines changed

SHARED-CI.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ task 👈 all tasks go here
6363
│ │ └── pre-apply-task-hook.sh 👈 Optional hook
6464
│ └── 0.2
6565
│ ├── hello.yaml
66-
│ ├── MIGRATION.md 👈 migration notes for this version
6766
│ ├── migrations
6867
│ │ └── 0.2.sh 👈 script for migrating to 0.2
6968
│ └── README.md
@@ -93,35 +92,46 @@ It does so by running ShellCheck. For more details, see the [checkton project](h
9392
- script: [`hack/validate-migration.sh`](hack/validate-migration.sh)
9493
- Validates migration scripts.
9594
- workflow: [`.github/workflows/check-task-migration.yaml`](.github/workflows/check-task-migration.yaml)
96-
- Validates migration scripts and ensures MIGRATION.md is provided.
95+
- Validates migration scripts.
9796

9897
Task migrations allow task maintainers to introduce changes to Konflux standard
9998
pipelines according to the task updates. By creating migrations, task
10099
maintainers are able to add/remove/update task parameters, change task
101100
execution order, add/remove mandatory task to/from pipelines, etc.
102101

103-
Historically, task maintainers write `MIGRATION.md` to notify users what changes
104-
have to be made to the pipeline. This mechanism is not deprecated. Besides
105-
writing the document, it is also recommended to write a migration script so that the
106-
updates can be applied to user pipelines automatically, that is done by the
102+
Task maintainers record task changes in `CHANGELOG.md`. If there is any
103+
pipeline changes accordingly, it is also recommended to create a task migration
104+
in order to be applied to user pipelines automatically, that is done by the
107105
[pipeline-migration-tool](https://github.com/konflux-ci/pipeline-migration-tool).
108106

109-
Task migrations are Bash scripts defined in version-specific task
110-
directories. In general, a migration consists of a series of `yq` commands that
111-
modify pipeline in order to work with the new version of task. Developers can
112-
do more with task migrations on the pipelines, e.g. add/remove a task,
113-
add/remove/update task parameters, change execution order of a task, etc.
107+
Task migrations are Bash scripts defined in task directories. In general, a
108+
migration consists of a series of `yq` commands that modify pipeline in order
109+
to work with the new version of task. Developers can do more with task
110+
migrations on the pipelines, e.g. add/remove a task, add/remove/update task
111+
parameters, change execution order of a task, etc.
114112

115113
#### Create a migration
116114

117115
The following is the steps to write a migration:
118116

119117
- Bump task version. Modify label `app.kubernetes.io/version` in the task YAML file.
120-
- Ensure `migrations/` directory exists in the version-specific task directory.
118+
- Ensure `migrations/` directory exists in the task directory alongside the
119+
task YAML file.
121120
- Create a migration file under the `migrations/` directory. Its name is in
122121
form `<new task version>.sh`. Note that the version must match the bumped
123122
version.
124123

124+
For example, to create a migration for task `hello`, migration file should be
125+
present like this:
126+
127+
```
128+
task
129+
└── hello
130+
├── hello.yaml
131+
└── migrations
132+
└── 0.2.sh
133+
```
134+
125135
The migration file is a normal Bash script file:
126136

127137
- It accepts a single argument. The pipeline file path is provided via this
@@ -167,7 +177,7 @@ EOF
167177

168178
To add a new task to the user pipelines, a migration can be created with a
169179
fictional task update. That is to select a task, bump its version
170-
and create a migration under its version-specific directory.
180+
and create a migration under the task directory.
171181

172182
#### Create a startup migration by the helper script
173183

task/hello-oci-ta/0.2/MIGRATION.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

task/hello/0.2/MIGRATION.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

{{cookiecutter.repo_root}}/SHARED-CI.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ task 👈 all tasks go here
6363
│ │ └── pre-apply-task-hook.sh 👈 Optional hook
6464
│ └── 0.2
6565
│ ├── hello.yaml
66-
│ ├── MIGRATION.md 👈 migration notes for this version
6766
│ ├── migrations
6867
│ │ └── 0.2.sh 👈 script for migrating to 0.2
6968
│ └── README.md
@@ -93,35 +92,46 @@ It does so by running ShellCheck. For more details, see the [checkton project](h
9392
- script: [`hack/validate-migration.sh`](hack/validate-migration.sh)
9493
- Validates migration scripts.
9594
- workflow: [`.github/workflows/check-task-migration.yaml`](.github/workflows/check-task-migration.yaml)
96-
- Validates migration scripts and ensures MIGRATION.md is provided.
95+
- Validates migration scripts.
9796

9897
Task migrations allow task maintainers to introduce changes to Konflux standard
9998
pipelines according to the task updates. By creating migrations, task
10099
maintainers are able to add/remove/update task parameters, change task
101100
execution order, add/remove mandatory task to/from pipelines, etc.
102101

103-
Historically, task maintainers write `MIGRATION.md` to notify users what changes
104-
have to be made to the pipeline. This mechanism is not deprecated. Besides
105-
writing the document, it is also recommended to write a migration script so that the
106-
updates can be applied to user pipelines automatically, that is done by the
102+
Task maintainers record task changes in `CHANGELOG.md`. If there is any
103+
pipeline changes accordingly, it is also recommended to create a task migration
104+
in order to be applied to user pipelines automatically, that is done by the
107105
[pipeline-migration-tool](https://github.com/konflux-ci/pipeline-migration-tool).
108106

109-
Task migrations are Bash scripts defined in version-specific task
110-
directories. In general, a migration consists of a series of `yq` commands that
111-
modify pipeline in order to work with the new version of task. Developers can
112-
do more with task migrations on the pipelines, e.g. add/remove a task,
113-
add/remove/update task parameters, change execution order of a task, etc.
107+
Task migrations are Bash scripts defined in task directories. In general, a
108+
migration consists of a series of `yq` commands that modify pipeline in order
109+
to work with the new version of task. Developers can do more with task
110+
migrations on the pipelines, e.g. add/remove a task, add/remove/update task
111+
parameters, change execution order of a task, etc.
114112

115113
#### Create a migration
116114

117115
The following is the steps to write a migration:
118116

119117
- Bump task version. Modify label `app.kubernetes.io/version` in the task YAML file.
120-
- Ensure `migrations/` directory exists in the version-specific task directory.
118+
- Ensure `migrations/` directory exists in the task directory alongside the
119+
task YAML file.
121120
- Create a migration file under the `migrations/` directory. Its name is in
122121
form `<new task version>.sh`. Note that the version must match the bumped
123122
version.
124123

124+
For example, to create a migration for task `hello`, migration file should be
125+
present like this:
126+
127+
```
128+
task
129+
└── hello
130+
├── hello.yaml
131+
└── migrations
132+
└── 0.2.sh
133+
```
134+
125135
The migration file is a normal Bash script file:
126136

127137
- It accepts a single argument. The pipeline file path is provided via this
@@ -167,7 +177,7 @@ EOF
167177

168178
To add a new task to the user pipelines, a migration can be created with a
169179
fictional task update. That is to select a task, bump its version
170-
and create a migration under its version-specific directory.
180+
and create a migration under the task directory.
171181

172182
#### Create a startup migration by the helper script
173183

0 commit comments

Comments
 (0)