Skip to content

Commit

Permalink
CSCwi89338: Enhance published rpm build tool to replicate internal bu…
Browse files Browse the repository at this point in the history
…ild rpm tool
  • Loading branch information
nburnwalcisco committed Feb 5, 2024
1 parent a400af2 commit e65fe45
Show file tree
Hide file tree
Showing 15 changed files with 477 additions and 169 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ arhashem/xr-wrl7:
docker build docker -f docker/WRL7.Dockerfile -t arhashem/xr-wrl7

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

images: wrl7 centos

103 changes: 94 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
# xr-appmgr-build
Scripts to build RPMs for use with the XR appmgr.

# Building an RPM
# Building a native RPM

Create an `build.yaml` file and add entries for your app
Create a `build.yaml` file and add entries for your app
```
packages:
- name: "alpine"
release: "ThinXR_7.3.15" # Release should correspond to a file in release_configs dir
version: "0.1.0" # Application semantic version
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)
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)
version: "0.1.0" # Application semantic version (Editable)
sources:
- name: alpine # Will correspond to the source name on the router
file: examples/alpine/alpine.tar.gz # Path from xr-appmgr-build root to image
- name: alpine # Will correspond to the source name on the router (Editable)
file: examples/alpine/swanagent.tar # Path from xr-appmgr-build root to image (Editable)
# Tar file must be built with "--platform=linux/x86_64" option specified during docker build
config-dir:
- name: alpine-configs # The name of the directory for the app to mount in its docker run opts
dir: examples/alpine/config
- name: SwanAgent # The name of the directory for the app to mount in its docker run opts (Editable)
dir: examples/alpine/config #Not editable
copy_hostname: true # Copy router hostname into config dir (only useful for eXR platforms)
copy_ems_cert: true # Copy router ems certificate into config dir
```

# Building a TPA RPM
Create a `build.yaml` file and add entries for your app
```
- name: "partner-alpine" # Prefix "owner-" or "partner-" for TPA apps (Not editable)
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)
target-release: "7.10.1" # If present, this is the release for rpms to be installed, else above release is used. (Editable)
version: "3.14" #Editable
partner-name: "radware" # Needed only for Partner rpms (Editable)
sources:
- name: alpine # Name should match source tar file (Editable)
file: examples/alpine/alpine.tar.gz # File must have "tar.gz" extension (Editable)
# Tar file must be built with "--platform=linux/x86_64" option specified during docker build
```
Build:
`./appmgr_build -b examples/alpine/build.yaml`

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

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.
"grpc no-tls config should not be used if copy_ems_cert option is specified"


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

# Building a process-script RPM
Create a `build.yaml` file and add entries for your app
```
- name: "pscript" #This should not be changed (Not editable)
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)
target-release: "24.1.1" # If present, RPM name will have this target-release name, else will have above release name (Editable)
version: "0.1.0" # Application semantic version (Editable)
sources:
- name: pscript # Update this with the rpm name to be built (Editable)
dir: examples/pscript # All the files in this direcotory to be copied to process-script rpm (Editable)
```
Build:
`./appmgr_build -b examples/alpine/build.yaml`

Once the RPM is built, scp it to the router, and install.

```
scp RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm <router>:/harddisk:
```
You can install the RPM with the following:
(As it's not a docker container, no need to activate this rpm)
```
appmgr package install rpm /harddisk:/pscript-0.1.0-24.1.1.x86_64.rpm
```

Config:
You can uninstall the RPM with the following:
```
appmgr package uninstall package pscript-0.1.0-24.1.1.x86_64.rpm
```
The files in the rpm, will be copied to below location in the device
```
/var/lib/docker/appmgr/ops-script-repo/exec/
```

You can get rpm details using below commands
```
rpm -qpl RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm
warning: RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 73f45f20: NOKEY
/ops-script-repo/exec
/ops-script-repo/exec/pscript
/ops-script-repo/exec/pscript/.gitignore
rpm -qpi RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm
warning: RPMS/x86_64/pscript-0.1.0-24.1.1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 73f45f20: NOKEY
Name : pscript
Version : 0.1.0
Release : 24.1.1
Architecture: x86_64
Install Date: (not installed)
Group : 3rd party application
Size : 71
License : Copyright (c) 2020 Cisco Systems Inc. All rights reserved
Signature : DSA/SHA1, Thu 19 Oct 2023 03:59:30 PM IST, Key ID fd7228c573f45f20
Source RPM : pscript-0.1.0-24.1.1.src.rpm
Build Date : Thu 19 Oct 2023 03:59:30 PM IST
Build Host : aa727e7f9b26
Relocations : /
Packager : cisco
Summary : pscript 0.1.0 compiled for IOS-XR 24.1.1
```
We can optionally pass comma separated package name(s) in build command with -p option
```
./appmgr_build -b examples/alpine/build.yaml -p alpine,pscript
If we don't pass -p option, it will build for all the packages in build.yaml file.
```

# Build and Setup instructions

Expand Down
Loading

0 comments on commit e65fe45

Please sign in to comment.