From 63c2c54d80385e2ca6fb2ab6acc5069c20e28bc4 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Thu, 15 Feb 2024 11:52:58 +0300 Subject: [PATCH] docs: howto create patches (#9) - Commands to create patches for kubevirt or cdi ## Description Add an internal page with commands to create patches for kubevirt or cdi. ## Why do we need it, and what problem does it solve? It's easy to forget these infrequently executed commands. ## What is the expected result? ## Checklist - [ ] The code is covered by unit tests. - [ ] e2e tests passed. - [ ] Documentation updated according to the changes. - [ ] Changes were tested in the Kubernetes cluster manually. --------- Signed-off-by: Ivan Mikheykin --- .../{cdi.md => cdi_kubevirt_patching.md} | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) rename docs/internal/{cdi.md => cdi_kubevirt_patching.md} (76%) diff --git a/docs/internal/cdi.md b/docs/internal/cdi_kubevirt_patching.md similarity index 76% rename from docs/internal/cdi.md rename to docs/internal/cdi_kubevirt_patching.md index 79fe16f28..e91634004 100644 --- a/docs/internal/cdi.md +++ b/docs/internal/cdi_kubevirt_patching.md @@ -1,6 +1,11 @@ -# CDI +# Patching CDI or Kubevirt + +Kubevirt instructions are the same, just use repository `https://github.com/kubevirt/kubevirt.git`. ### Generate CRD + +Clone CDI sources using `$version` from cdi-artifact/werf.inc.yaml, apply patches and call `make manifests`. + ```bash mkdir tmp export VERSION="1.58.0" @@ -13,16 +18,21 @@ cd ../../ rm -rf tmp/cdi ``` -### Generate new patches from old + +### Porting patches to newer version of CDI + +We will bump CDI version in the future and patches will require porting. Apply existing patches using --ignore-space-change and --ignore-whitespace to ignore trivial conflicts and create patches again. + #### Prepare ```bash mkdir tmp -export VERSION="1.58.0" +export VERSION="1.58.1" git clone --depth 1 --branch v${VERSION} https://github.com/kubevirt/containerized-data-importer.git tmp/cdi cd tmp/cdi git checkout -b update-patches ``` -#### Generate patches + +#### Generate updated patches ```bash git apply --ignore-space-change --ignore-whitespace ../../images/cdi-artifact/patches/000-bundle-images.patch ## if patch failed - use --reject git add . && git commit -m "patch1" @@ -45,6 +55,9 @@ rm -rf tmp/cdi ``` ### Generate new patch from PR + +Incorporate PR from upstream as a patch. + #### Prepare ```bash mkdir tmp @@ -65,6 +78,7 @@ git diff --patch "" HEAD > 004-replicas.patch #### Copy new patches ```bash cp 004-replicas.patch ../../images/cdi-artifact/patches/004-replicas.patch +git add ../../images/cdi-artifact/patches/004-replicas.patch ``` #### Сlean ```bash