Skip to content

Commit

Permalink
-F does not work with -O, also some other cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Jun 29, 2023
1 parent 15f601c commit ab4b21f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
30 changes: 15 additions & 15 deletions opennms-container/core/plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export VELOCLOUD_VERSION="latest"

export DEPLOY_FOLDER="/opt/usr-plugins"

mkdir $DEPLOY_FOLDER
mkdir -p "$DEPLOY_FOLDER"

microdnf -y install cpio python3-pip jq
pip3 install --upgrade cloudsmith-cli
Expand All @@ -19,10 +19,10 @@ mkdir ~/test
cd ~/test || exit
artifact_urls=$(cloudsmith list packages --query="opennms-alec-plugin version:$ALEC_VERSION format:rpm" opennms/common -F json | jq -r '.data[].cdn_url')
for url in $artifact_urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
rpm2cpio *-alec-plugin*.rpm | cpio -id
find . -name '*.kar' -exec mv {} $DEPLOY_FOLDER \;
find . -name '*.kar' -exec mv '{}' "$DEPLOY_FOLDER" \;

cd ~/ || exit
rm -rf test
Expand All @@ -31,36 +31,36 @@ cd ~/test || exit

artifact_urls=$(cloudsmith list packages --query="opennms-plugin-cloud version:$CLOUD_VERSION format:rpm" opennms/common -F json | jq -r '.data[].cdn_url')
for url in $artifact_urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
rpm2cpio *-plugin-cloud*.rpm | cpio -id
find . -name '*.kar' -exec mv {} $DEPLOY_FOLDER \;
find . -name '*.kar' -exec mv '{}' "$DEPLOY_FOLDER" \;

cd ..
rm -r test

cd $DEPLOY_FOLDER || exit
if [ $CORTEX_VERSION == "latest" ]
cd "$DEPLOY_FOLDER" || exit
if [ "$CORTEX_VERSION" == "latest" ]
then
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-cortex-tss-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-cortex-tss-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
else
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-cortex-tss-plugin/releases | jq -r '.[] | select(.tag_name=="$CORTEX_VERSION") | .assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-cortex-tss-plugin/releases | jq -r '.[] | select(.tag_name=="$CORTEX_VERSION") | .assets[0].browser_download_url')
fi
if [ -n "$artifact_urls" ]; then
for url in $artifact_urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
fi

cd $DEPLOY_FOLDER || exit
if [ $VELOCLOUD_VERSION == "latest" ]
cd "$DEPLOY_FOLDER" || exit
if [ "$VELOCLOUD_VERSION" == "latest" ]
then
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
else
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[] | select(.tag_name=="$VELOCLOUD_VERSION") | .assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[] | select(.tag_name=="$VELOCLOUD_VERSION") | .assets[0].browser_download_url')
fi
if [ -n "$artifact_urls" ]; then
for url in $artifact_urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
fi
8 changes: 4 additions & 4 deletions opennms-container/minion/plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ IFS=$'\n\t'
export VELOCLOUD_VERSION="latest"
export DEPLOY_FOLDER="/opt/usr-plugins"

mkdir $DEPLOY_FOLDER
mkdir -p "$DEPLOY_FOLDER"

microdnf -y install jq

cd $DEPLOY_FOLDER || exit
if [ $VELOCLOUD_VERSION == "latest" ]
then
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[0].assets[0].browser_download_url')
else
artifact_urls=$(curl -sSF https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[] | select(.tag_name=="$VELOCLOUD_VERSION") | .assets[0].browser_download_url')
artifact_urls=$(curl -sS https://api.github.com/repos/OpenNMS/opennms-velocloud-plugin/releases | jq -r '.[] | select(.tag_name=="$VELOCLOUD_VERSION") | .assets[0].browser_download_url')
fi
if [ -n "$artifact_urls" ]; then
for url in $artifact_urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
fi
10 changes: 6 additions & 4 deletions opennms-container/sentinel/plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ export CLOUD_VERSION="latest"
#export DEPLOY_FOLDER="/usr/share/opennms/deploy"
export DEPLOY_FOLDER="/opt/usr-plugins"

mkdir -p "$DEPLOY_FOLDER"

microdnf -y install cpio python3-pip jq
pip3 install --upgrade cloudsmith-cli

mkdir ~/test
cd ~/test || exit
urls=$(cloudsmith list packages --query="sentinel-alec-plugin version:$ALEC_VERSION format:rpm" opennms/common -F json | jq -r '.data[].cdn_url')
for url in $urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
rpm2cpio *-alec-plugin*.rpm | cpio -id
find . -name '*.kar' -exec mv {} $DEPLOY_FOLDER \;
find . -name '*.kar' -exec mv '{}' "$DEPLOY_FOLDER" \;


urls=$(cloudsmith list packages --query="sentinel-plugin-cloud version:$CLOUD_VERSION format:rpm" opennms/common -F json | jq -r '.data[].cdn_url')
for url in $urls; do
curl -sSF -L -O "$url"
curl -sS -L -O "$url"
done
rpm2cpio *-plugin-cloud*.rpm | cpio -id
find . -name '*.kar' -exec mv {} $DEPLOY_FOLDER \;
find . -name '*.kar' -exec mv '{}' "$DEPLOY_FOLDER" \;

cd ..
rm -r test

0 comments on commit ab4b21f

Please sign in to comment.