Skip to content

Commit 423890f

Browse files
committed
Added version into build and main
1 parent afc07f1 commit 423890f

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

adc.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
ADC_VERSION="v0.2.0"
3+
ADC_LAST_COMMIT="afc07f1824d883268d9e9d007c63ad3fd6e04de3"
24
USER_CONFIG="$HOME/.appdynamics/adc/config.sh"
35
GLOBAL_CONFIG="/etc/appdynamics/adc/config.sh"
46
CONFIG_CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-controller-cookie.txt"
@@ -300,6 +302,13 @@ function _help {
300302
fi
301303
}
302304
register _help Display the global usage information
305+
function _version {
306+
COMMAND_RESULT="$ADC_VERSION ~ $ADC_LAST_COMMIT"
307+
}
308+
register _config Print the current version of $SCRIPTNAME
309+
describe _config << EOF
310+
Print the current version of $SCRIPTNAME
311+
EOF
303312
CONTROLLER_LOGIN_STATUS=0
304313
function controller_login {
305314
debug "Login at $CONFIG_CONTROLLER_HOST with $CONFIG_CONTROLLER_CREDENTIALS"

build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
2-
2+
LATEST_RELEASE=`git tag | tail -n 1`
3+
LATEST_COMMIT=`git rev-parse HEAD`
34
awk '
45
$1 == "source" {system("tail -n +2 " $2); next}
56
{print}
6-
' main.sh | sed '/^\s*$/d' > adc.sh
7+
' main.sh | sed '/^\s*$/d' \
8+
| sed "s/ADC_VERSION=\"vx.y.z\"/ADC_VERSION=\"$LATEST_RELEASE\"/" \
9+
| sed "s/ADC_LAST_COMMIT=\"xxxxxxxxxx\"/ADC_LAST_COMMIT=\"$LATEST_COMMIT\"/" > adc.sh

commands/version.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
function _version {
4+
COMMAND_RESULT="$ADC_VERSION ~ $ADC_LAST_COMMIT"
5+
}
6+
7+
register _config Print the current version of $SCRIPTNAME
8+
describe _config << EOF
9+
Print the current version of $SCRIPTNAME
10+
EOF

main.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
ADC_VERSION="vx.y.z"
3+
ADC_LAST_COMMIT="xxxxxxxxxx"
24
USER_CONFIG="$HOME/.appdynamics/adc/config.sh"
35
GLOBAL_CONFIG="/etc/appdynamics/adc/config.sh"
46

@@ -44,6 +46,7 @@ source ./helpers/apiCall.sh
4446

4547
source ./commands/config.sh
4648
source ./commands/help.sh
49+
source ./commands/version.sh
4750

4851
source ./commands/controller/login.sh
4952
source ./commands/controller/call.sh

0 commit comments

Comments
 (0)