Skip to content

Commit e65fe45

Browse files
committed
CSCwi89338: Enhance published rpm build tool to replicate internal build rpm tool
1 parent a400af2 commit e65fe45

File tree

15 files changed

+477
-169
lines changed

15 files changed

+477
-169
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ arhashem/xr-wrl7:
44
docker build docker -f docker/WRL7.Dockerfile -t arhashem/xr-wrl7
55

66
arhashem/xr-centos:
7-
docker build docker -f docker/Centos.Dockerfile -t arhashem/xr-centos
7+
docker build --platform=linux/x86_64 docker -f docker/Centos.Dockerfile -t arhashem/xr-centos
88

99
images: wrl7 centos
1010

README.md

+94-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
# xr-appmgr-build
22
Scripts to build RPMs for use with the XR appmgr.
33

4-
# Building an RPM
4+
# Building a native RPM
55

6-
Create an `build.yaml` file and add entries for your app
6+
Create a `build.yaml` file and add entries for your app
77
```
8-
packages:
98
- name: "alpine"
10-
release: "ThinXR_7.3.15" # Release should correspond to a file in release_configs dir
11-
version: "0.1.0" # Application semantic version
9+
release: "ThinXR_7.3.15" # Release is the release since when the support for this rpm has started and should correspond to a file in release_configs dir (Not editable)
10+
target-release: "ThinXR_7.3.15" # Target release if present, RPM name will have this target-release name, else will have above release name (Editable)
11+
version: "0.1.0" # Application semantic version (Editable)
1212
sources:
13-
- name: alpine # Will correspond to the source name on the router
14-
file: examples/alpine/alpine.tar.gz # Path from xr-appmgr-build root to image
13+
- name: alpine # Will correspond to the source name on the router (Editable)
14+
file: examples/alpine/swanagent.tar # Path from xr-appmgr-build root to image (Editable)
15+
# Tar file must be built with "--platform=linux/x86_64" option specified during docker build
1516
config-dir:
16-
- name: alpine-configs # The name of the directory for the app to mount in its docker run opts
17-
dir: examples/alpine/config
17+
- name: SwanAgent # The name of the directory for the app to mount in its docker run opts (Editable)
18+
dir: examples/alpine/config #Not editable
1819
copy_hostname: true # Copy router hostname into config dir (only useful for eXR platforms)
1920
copy_ems_cert: true # Copy router ems certificate into config dir
2021
```
22+
23+
# Building a TPA RPM
24+
Create a `build.yaml` file and add entries for your app
25+
```
26+
- name: "partner-alpine" # Prefix "owner-" or "partner-" for TPA apps (Not editable)
27+
release: "7.10.1" # This is the release since when the support for this rpm has started and should correspond to a file in release_configs dir (Not editable)
28+
target-release: "7.10.1" # If present, this is the release for rpms to be installed, else above release is used. (Editable)
29+
version: "3.14" #Editable
30+
partner-name: "radware" # Needed only for Partner rpms (Editable)
31+
sources:
32+
- name: alpine # Name should match source tar file (Editable)
33+
file: examples/alpine/alpine.tar.gz # File must have "tar.gz" extension (Editable)
34+
# Tar file must be built with "--platform=linux/x86_64" option specified during docker build
35+
```
2136
Build:
2237
`./appmgr_build -b examples/alpine/build.yaml`
2338

@@ -28,6 +43,8 @@ scp RPMS/x86_64/alpine-0.1.0-eXR_7.3.1.x86_64.rpm <router>:/harddisk:
2843
```
2944

3045
Note that if you specify `copy_ems_cert` you must install the RPM after gRPC is configured (see above). The post-install script requires the ems certificate to have been created at install time or the application will be unable to access it.
46+
"grpc no-tls config should not be used if copy_ems_cert option is specified"
47+
3148

3249
```
3350
appmgr package install rpm /harddisk:/alpine-0.1.0-eXR_7.3.1.x86_64.rpm
@@ -43,6 +60,74 @@ You can uninstall the RPM with the following:
4360
appmgr package uninstall package alpine-0.1.0-eXR_7.3.1.x86_64
4461
```
4562

63+
# Building a process-script RPM
64+
Create a `build.yaml` file and add entries for your app
65+
```
66+
- name: "pscript" #This should not be changed (Not editable)
67+
release: "24.1.1" # This is the release since when the support for this rpm has started and should correspond to a file in release_configs dir (Not editable)
68+
target-release: "24.1.1" # If present, RPM name will have this target-release name, else will have above release name (Editable)
69+
version: "0.1.0" # Application semantic version (Editable)
70+
sources:
71+
- name: pscript # Update this with the rpm name to be built (Editable)
72+
dir: examples/pscript # All the files in this direcotory to be copied to process-script rpm (Editable)
73+
74+
```
75+
Build:
76+
`./appmgr_build -b examples/alpine/build.yaml`
77+
78+
Once the RPM is built, scp it to the router, and install.
79+
80+
```
81+
scp RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm <router>:/harddisk:
82+
```
83+
You can install the RPM with the following:
84+
(As it's not a docker container, no need to activate this rpm)
85+
```
86+
appmgr package install rpm /harddisk:/pscript-0.1.0-24.1.1.x86_64.rpm
87+
```
88+
89+
Config:
90+
You can uninstall the RPM with the following:
91+
```
92+
appmgr package uninstall package pscript-0.1.0-24.1.1.x86_64.rpm
93+
```
94+
The files in the rpm, will be copied to below location in the device
95+
```
96+
/var/lib/docker/appmgr/ops-script-repo/exec/
97+
```
98+
99+
You can get rpm details using below commands
100+
```
101+
rpm -qpl RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm
102+
warning: RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 73f45f20: NOKEY
103+
/ops-script-repo/exec
104+
/ops-script-repo/exec/pscript
105+
/ops-script-repo/exec/pscript/.gitignore
106+
107+
rpm -qpi RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm
108+
warning: RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 73f45f20: NOKEY
109+
Name : pscript
110+
Version : 0.1.0
111+
Release : 24.1.1
112+
Architecture: x86_64
113+
Install Date: (not installed)
114+
Group : 3rd party application
115+
Size : 71
116+
License : Copyright (c) 2020 Cisco Systems Inc. All rights reserved
117+
Signature : DSA/SHA1, Thu 19 Oct 2023 03:59:30 PM IST, Key ID fd7228c573f45f20
118+
Source RPM : pscript-0.1.0-24.1.1.src.rpm
119+
Build Date : Thu 19 Oct 2023 03:59:30 PM IST
120+
Build Host : aa727e7f9b26
121+
Relocations : /
122+
Packager : cisco
123+
Summary : pscript 0.1.0 compiled for IOS-XR 24.1.1
124+
```
125+
We can optionally pass comma separated package name(s) in build command with -p option
126+
```
127+
./appmgr_build -b examples/alpine/build.yaml -p alpine,pscript
128+
129+
If we don't pass -p option, it will build for all the packages in build.yaml file.
130+
```
46131

47132
# Build and Setup instructions
48133

0 commit comments

Comments
 (0)