forked from hlavki/nexus-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.sh
executable file
·40 lines (31 loc) · 892 Bytes
/
delete.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
#!/bin/bash
# A simple example script that publishes a number of scripts to the Nexus Repository Manager
# and executes them.
# fail if anything errors
set -e
# fail if a function call is missing an argument
set -u
while getopts u:p:h: option
do
case "${option}"
in
u) username=${OPTARG};;
p) password=${OPTARG};;
h) host=${OPTARG};;
esac
done
echo $host
# add a script to the repository manager and run it
function addAndRunScript {
name=$1
curl -v -X DELETE -u $username:$password "$host/service/rest/v1/script/$name"
printf "\nDeleted script $name\n\n"
}
printf "Provisioning Integration API Scripts Starting \n\n"
printf "Publishing and executing on $host\n"
addAndRunScript listAssets
addAndRunScript deleteAssets
addAndRunScript deleteDockerReleasedSnapshots
addAndRunScript listComponents
addAndRunScript deleteComponents
printf "\nDeleting Scripts Completed\n\n"