-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
172 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
def label = "worker-${UUID.randomUUID().toString()}" | ||
|
||
properties( | ||
[parameters( | ||
[ | ||
string(defaultValue: 'IoT_API', description: '', name: 'CMA_APPLICATION_NAME', trim: false), | ||
choice(choices: ['configmyappdemo-2044no-uzyczrm0.appd-cx.com', 'dev-configmyappdemo-2044no-uzyczrm0.appd-cx.com'], description: 'Select AppDynamics Controller', name: 'CMA_CONTROLLER_HOST'), | ||
choice(choices: ['customer1', 'dev-customer1'], description: 'Select AppDynamics Account', name: 'CMA_ACCOUNT'), | ||
string(defaultValue: '8090', description: 'Controller Port', name: 'CMA_CONTROLLER_PORT', trim: true), | ||
booleanParam(defaultValue: 'false', description: 'Use HTTPS?', name: 'CMA_USE_HTTPS', trim: false), | ||
booleanParam(defaultValue: false, description: 'Include Server visibility', name: 'CMA_INCLUDE_SIM'), | ||
booleanParam(defaultValue: false, description: 'Configure ONLY Buisness transactions', name: 'CMA_BT_ONLY'), | ||
booleanParam(defaultValue: false, description: 'Add Business Transactions', name: 'CMA_CONFIGURE_BT'), | ||
booleanParam(defaultValue: false, description: 'Include Database', name: 'CMA_INCLUDE_DATABASE'), | ||
string(defaultValue: 'app-db', description: 'If Include DB, set DB collector name', name: 'CMA_DATABASE_NAME', trim: false), | ||
booleanParam(defaultValue: false, description: 'Overwrite Existing Health Rules', name: 'CMA_OVERWRITE_HEALTH_RULES') | ||
]) | ||
] | ||
) | ||
|
||
node { | ||
// Clean workspace before doing anything | ||
deleteDir() | ||
try { | ||
|
||
stage ('Clone') { | ||
checkout scm | ||
} | ||
|
||
stage('ConfigMyApp') { | ||
|
||
withCredentials([usernamePassword(credentialsId: 'controller_credentials', passwordVariable: 'CMA_PASSWORD', usernameVariable: 'CMA_USERNAME')]) { | ||
sh """ | ||
echo "ConfigMyApp...start " | ||
export CMA_APPLICATION_NAME=${params.CMA_APPLICATION_NAME} | ||
export CMA_CONTROLLER_HOST=${params.CMA_CONTROLLER_HOST} | ||
export CMA_USE_HTTPS=${params.CMA_USE_HTTPS} | ||
export CMA_CONTROLLER_PORT=${params.CMA_CONTROLLER_PORT} | ||
export CMA_BT_ONLY=${params.CMA_BT_ONLY} | ||
export CMA_ACCOUNT=${params.CMA_ACCOUNT} | ||
export CMA_INCLUDE_SIM=${params.CMA_INCLUDE_SIM} | ||
export CMA_CONFIGURE_BT=${params.CMA_CONFIGURE_BT} | ||
export CMA_INCLUDE_DATABASE=${params.CMA_INCLUDE_DATABASE} | ||
LOCATION=\$(curl -s https://api.github.com/repos/Appdynamics/ConfigMyApp/releases/latest \ | ||
| grep "tag_name" \ | ||
| awk '{print "https://github.com/Appdynamics/ConfigMyApp/archive/" substr(\$2, 2, length(\$2)-3) ".zip"}') \ | ||
; curl -L -o ConfigMyApp.zip \$LOCATION | ||
ls -ltr | ||
# apt-get install unzip -y | ||
unzip ConfigMyApp.zip | ||
cd ConfigMyApp-* | ||
#Branding | ||
background="https://user-images.githubusercontent.com/2548160/90539325-97103100-e177-11ea-975a-6ae777ae03e3.jpg" | ||
curl -o "branding/background.jpg" \$background | ||
logo="https://user-images.githubusercontent.com/2548160/90539333-98d9f480-e177-11ea-99b9-8b72a2fe525a.png" | ||
curl -o "branding/logo.png" \$logo | ||
pwd | ||
ls ${workspace}@script/ | ||
ls ${workspace} | ||
if [ "\$CMA_BT_ONLY" = true ] || [ "\$CMA_CONFIGURE_BT" = true ]; then | ||
cp ${workspace}/bt_config/${params.CMA_APPLICATION_NAME}-configBT.json bt_config/configBT.json | ||
fi | ||
#ls -ltr | ||
echo "Start script" | ||
if [ "\$CMA_INCLUDE_DATABASE" = true ]; then | ||
./start.sh --include-database --database-name='${params.CMA_DATABASE_NAME}' --overwrite-health-rules --use-branding --logo-name="logo.png" --background-name="background.jpg" | ||
else | ||
./start.sh --overwrite-health-rules --use-branding --logo-name="logo.png" --background-name="background.jpg" --debug | ||
fi | ||
echo "End script" | ||
""" | ||
|
||
} | ||
} | ||
}catch (err) { | ||
currentBuild.result = 'FAILED' | ||
throw err | ||
} | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Starter pipeline | ||
# Start with a minimal pipeline that you can customize to build and deploy your code. | ||
# Add steps that build, run tests, deploy, and more: | ||
# https://aka.ms/yaml | ||
|
||
|
||
trigger: | ||
- master | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
environment: | ||
name: 'CMA' | ||
tags: configmyapp | ||
|
||
# Set variables once as shown below, use the UI | ||
variables: | ||
#CMA_APPLICATION_NAME: IoT_API | ||
CMA_CONTROLLER_HOST: configmyappdemo-2044no-uzyczrm0.appd-cx.com | ||
CMA_CONTROLLER_PORT: 8090 | ||
CMA_ACCOUNT: customer1 | ||
CMA_USE_HTTPS: false | ||
CMA_USERNAME: appd | ||
CMA_CONFIGURE_BT: true | ||
#CMA_INCLUDE_SIM: true | ||
#CMA_BT_ONLY: false | ||
#CMA_INCLUDE_DATABASE : false | ||
#CMA_OVERWRITE_HEALTH_RULES: true | ||
#CMA_DATABASE_NAME: ConfigMyApp | ||
|
||
steps: | ||
- script: | | ||
# Write your commands here | ||
LOCATION=$(curl -s https://api.github.com/repos/Appdynamics/ConfigMyApp/releases/latest \ | ||
| grep "tag_name" \ | ||
| awk '{print "https://github.com/Appdynamics/ConfigMyApp/archive/" substr($2, 2, length($2)-3) ".zip"}') \ | ||
; curl -L -o ConfigMyApp.zip $LOCATION | ||
pwd | ||
ls -ltr | ||
# apt-get install unzip -y | ||
unzip ConfigMyApp.zip | ||
cd ConfigMyApp-* | ||
#Branding # | ||
#Get it from a remote location | ||
#background="https://user-images.githubusercontent.com/2548160/88209855-36123d80-cc4b-11ea-8a46-8bf8bd02bbb5.jpg" | ||
#curl -o "branding/background.jpg" $background | ||
#logo="https://user-images.githubusercontent.com/2548160/88204707-9a310380-cc43-11ea-9149-561199f144af.png" | ||
#curl -o "branding/logo.png" $logo | ||
#OR copy the files from git | ||
cp ../branding/background.png branding/background.png | ||
cp ../branding/logo.png branding/logo.png | ||
echo CMA_BT_ONLY = $CMA_BT_ONLY | ||
echo CMA_CONFIGURE_BT = $CMA_CONFIGURE_BT | ||
if [ "$CMA_BT_ONLY" = true ] || [ "$CMA_CONFIGURE_BT" = true ]; then | ||
cp ../bt_config/$CMA_APPLICATION_NAME-configBT.json bt_config/configBT.json | ||
./start.sh --include-database --database-name="$CMA_DATABASE_NAME" --use-branding --logo-name="logo.png" --background-name="background.png" | ||
else | ||
./start.sh --use-branding --logo-name="logo.png" --background-name="background.png" | ||
fi | ||
echo "End script##" | ||
displayName: 'Run ConfigMyApp' | ||
env: | ||
CMA_PASSWORD: $(CMA_PASSWORD) | ||
CMA_APPLICATION_NAME: $(CMA_APPLICATION_NAME) | ||
CMA_INCLUDE_SIM: $(CMA_INCLUDE_SIM) | ||
CMA_CONFIGURE_BT: $(CMA_CONFIGURE_BT) | ||
CMA_BT_ONLY: $(CMA_BT_ONLY) | ||
CMA_INCLUDE_DATABASE: $(CMA_INCLUDE_DATABASE) | ||
CMA_DATABASE_NAME: $(CMA_DATABASE_NAME) | ||
CMA_OVERWRITE_HEALTH_RULES: $(CMA_OVERWRITE_HEALTH_RULES) | ||
|
||
|