Skip to content

Commit

Permalink
docs: howto create patches (#9)
Browse files Browse the repository at this point in the history
- 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?
<!---
  How can one check these changes after applying?  

Describe, what (resource, state, event, etc.) MUST or MUST NOT
change/happen after applying these changes.
-->

## 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 <[email protected]>
  • Loading branch information
diafour authored Feb 15, 2024
1 parent d24023d commit 63c2c54
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions docs/internal/cdi.md → docs/internal/cdi_kubevirt_patching.md
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand All @@ -45,6 +55,9 @@ rm -rf tmp/cdi
```

### Generate new patch from PR

Incorporate PR from upstream as a patch.

#### Prepare
```bash
mkdir tmp
Expand All @@ -65,6 +78,7 @@ git diff --patch "<TAG COMMIT>" 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
Expand Down

0 comments on commit 63c2c54

Please sign in to comment.