forked from aquasecurity/trivy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy-rpm.sh
executable file
·51 lines (38 loc) · 1.53 KB
/
deploy-rpm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
TRIVY_VERSION=$(find dist/ -type f -name "*64bit.rpm" -printf "%f\n" | head -n1 | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
function create_common_rpm_repo () {
rpm_path=$1
ARCHES=("x86_64" "aarch64")
for arch in ${ARCHES[@]}; do
prefix=$arch
if [ "$arch" == "x86_64" ]; then
prefix="64bit"
elif [ "$arch" == "aarch64" ]; then
prefix="ARM64"
fi
mkdir -p $rpm_path/$arch
cp ../dist/*${prefix}.rpm ${rpm_path}/$arch/
createrepo_c -u https://github.com/aquasecurity/trivy/releases/download/ --location-prefix="v"$TRIVY_VERSION --update $rpm_path/$arch
rm ${rpm_path}/$arch/*${prefix}.rpm
done
}
function create_rpm_repo () {
version=$1
rpm_path=rpm/releases/${version}/x86_64
mkdir -p $rpm_path
cp ../dist/*64bit.rpm ${rpm_path}/
createrepo_c -u https://github.com/aquasecurity/trivy/releases/download/ --location-prefix="v"$TRIVY_VERSION --update $rpm_path
rm ${rpm_path}/*64bit.rpm
}
echo "Create RPM releases for Trivy v$TRIVY_VERSION"
cd trivy-repo
echo "Processing common repository for RHEL/CentOS..."
create_common_rpm_repo rpm/releases
VERSIONS=(5 6 7 8 9)
for version in ${VERSIONS[@]}; do
echo "Processing RHEL/CentOS $version..."
create_rpm_repo $version
done
git add .
git commit -m "Update rpm packages for Trivy v$TRIVY_VERSION"
git push origin main