HOWTO create a patch
Why do that¶
You have ecountered a bug in a running Punchplatform. A Punch ticket have been resolved, you now want to create a patch in order deliver it to your customer
Prerequisites¶
- You must have an access to punchplatform repository
What to do¶
-
Pull the last version of your punchplatform repository with the correct branch
$ cd $PP_PUNCH $ git pull
-
Correct your bug and commit it by indicating the ticket number
-
Create patch archive
Do not forget that all components are not patchable check this explanation to have more details.
To simplify, all patchable are located in punch-binaries-/lib folder in pp-punch repository.
Once you have built the entire pp-punch repository containing your fix, go to : pp-punch/packagings/punch-binaries/target/tmp/lib folder to get your patched library
Important
For a patch concerning storm, spark or pyspark, you must create a zip archive containing a subdirectory called storm, spark or pyspark. This subdirectory must contains all jars even those are not impacted by the fix
For example :
-
For a patch on shiva, you only need to deliver punch-shiva-app-*.jar as a patch.
-
For a patch on spark, you have to deliver a zip structured as follow :
1 2 3 4 5 6 7 8 9 10 11 12 13 14
```sh Archive: test.zip Length Date Time Name --------- ---------- ----- ---- 0 2020-08-21 14:30 spark/ 236298007 2020-08-21 14:29 spark/punch-spark-uber-6.1.0-jar-with-dependencies.jar 17185 2020-08-21 11:57 spark/punch-spark-scan-6.1.0.jar 28499 2020-08-21 11:57 spark/punch-spark-job-6.1.0.jar 72418703 2020-08-21 11:59 spark/punch-spark-metrics-6.1.0-jar-with-dependencies.jar 10299 2020-08-21 11:56 spark/punch-spark-configuration-6.1.0.jar 147864412 2020-08-21 11:58 spark/punch-spark-client-6.1.0-jar-with-dependencies.jar --------- ------- 456637105 7 files ```
-
-
Deploy
Your patch is ready, contact the person in charge of updating patches on Punch website
Create inventory/role patch¶
First of all, apply modifications to your roles and inventory files. When modification are committed and pushed to the main branch you can then proceed to generate your patch.
-
You just have to change directory to
punch-deployment
directory :cd packagings/punch-deployment
-
Depending on the files you want to embed in your patch you have 2 solutions details below. In any case it will generate a zip archive containing the patched inventory templates (deployer_patch/inventory_templates) and the patched pp_roles(deployer_patch/pp_roles) and a README file containing the list of embedded files.
-
only embed one role :
This command will look inside roles directories, inventory_templates files and resources files if a path matches the pattern *kibana*.mvn clean install -DpatchName=kibana
List of files will be :
deployer_patch/
├── inventory_templates
│ └── group_vars
│ └── kibana_servers.group_vars.j2
├── pp_roles
│ ├── kibana-data-extraction-plugin
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── config.yml.j2
│ │ └── vars
│ │ └── main.yml
│ ├── kibana-opendistro-security-plugin
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── config.yml.j2
│ │ └── vars
│ │ └── main.yml
│ ├── kibana-plugins-handler
│ │ ├── tasks
│ │ │ └── install_plugin.yml
│ │ └── vars
│ │ └── main.yml
│ ├── kibana-punch-documentation-plugin
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── config.yml.j2
│ │ └── vars
│ │ └── main.yml
│ ├── kibana-punchplatform-feedback-plugin
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── config.yml.j2
│ │ └── vars
│ │ └── main.yml
│ ├── kibana-punchplatform-plugin
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── config.yml.j2
│ │ └── vars
│ │ └── main.yml
│ └── kibana-server
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ ├── debootstrap.yml
│ │ └── main.yml
│ ├── templates
│ │ ├── kibana.service
│ │ └── kibana.yml.j2
│ └── vars
│ └── main.yml
└── README_2022-09-07T15:42:46+02:00_PATCH_kibana_b466ef1b96
mvn clean install -DpatchName=PUN-XXXX_kafka_issues -DpatchFileRegex="\(.*punchplatform-deployment-inventory.*\|resources/roles/kafka-setup\|resources/inventory_template/group_vars/kafka_servers.group_vars.j2\|.*deploy-punchplatform.*\)"
deployer_patch/
├── inventory_templates
│ ├── deploy-punchplatform-production-cluster.yml
│ ├── group_vars
│ │ └── kafka_servers.group_vars.j2
│ └── punchplatform-deployment-inventory-template.j2
├── pp_roles
│ └── kafka-setup
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ └── vars
│ └── main.yml
└── README_2022-09-07T15:42:46+02:00_PATCH_PUN-XXXX_kafka_issues_b466ef1b96
File name convention¶
patched_PUN-XXXX_kafka_issues-6.4.4-b466ef1b96.zip
Zip file name is composed of :
- the name of the patch (-DpatchName
value) : PUN-XXXX_Kafka_issues
- the curent version of punchplatform : 6.4.4
- the hash of the last punchplatform commit : b466ef1b96
README_2022-09-07T15:42:46+02:00_PATCH_PUN-XXXX_kafka_issues_b466ef1b96
The README file name is composed of :
- the timestamp of the last commit : 2022-09-07T15:42:46+02:00
- The name of the patch (-DpatchName
value) : PUN-XXXX_kafka_issues
- the hash of the last punchplatform commit : b466ef1b96
Warning
There is a commented line within patch.sh that can be uncommented to prevent the user to create the patch directory if his local branch isn't up-to-date.