pipeline for testing master = Parameters
pipeline {
agent any
parameters {
string(name: 'name', defaultValue: 'DefaultName', description: 'First name')
string(name: 'surname', defaultValue: 'DefaultSurname', description: 'Surname')
}
stages {
stage('Hello') {
steps {
echo 'Hello World'
echo "This is ${name} ${surname}"
}
}
}
}
Working url
http://54.179.243.7:8080/buildByToken/buildWithParameters?token=12345&job=temp_test&name=Java&surname=aem
Working url for testing_paramet_master
http://54.179.243.7:8080/buildByToken/buildWithParameters?token=117ada52dab985eead7db38d5dd009b055&job=Testing_parameter_master&GAME_ID=test&Gamedata=%7B%22gameid%22%3A%222wcMGO2SbGaSD50hPuxxdIRGEsDNjT8s%22%2C%22gameType%22%3A%22spaceshooter%22%2C%22playerData%22%3A%22player1%22%2C%22enemy1Data%22%3A%22enemy1%22%2C%22bulletData%22%3A%22bullet1%22%2C%22gamename%22%3A%22Gooey%22%2C%22logoSpriteFrame%22%3A%22logo1%22%2C%22gameoverImageSpriteFrame%22%3A%22gameover1%22%2C%22introBG%22%3A%22bg1%22%2C%22playBG%22%3A%22bg1%22%2C%22endBG%22%3A%22bg1%22%7D&UserId=user123&Usertype=new
pipeline for testing master = parameters Echo
pipeline {
agent any
parameters {
// Define parameters with default values
string(name: 'GAME_ID', defaultValue: 'default_game_id', description: 'Game ID to build')
text(name: 'Gamedata', defaultValue: '{}', description: 'Game data JSON')
string(name: 'UserId', defaultValue: 'default_user_id', description: 'User ID')
choice(name: 'Usertype', choices: ['new', 'old'], description: 'Type of user')
}
stages {
stage('Parse Parameters') {
steps {
script {
// Extract parameters from the 'parameters' object
def gameId = params.GAME_ID ?: 'default_game_id'
def gamedataJson = params.Gamedata ?: '{}'
def userId = params.UserId ?: 'default_user_id'
def userType = params.Usertype ?: 'new'
echo "GAME_ID: ${gameId}"
echo "Gamedata: ${gamedataJson}"
echo "UserId: ${userId}"
echo "Usertype: ${userType}"
// Additional processing with parsed parameters can be done here
}
}
}
// Add more stages as needed for your pipeline
}
}