Article Overview:
This article will cover how you can achieve the following:
An alternate Jenkins pipeline script to execute Virtuoso goals.
Problem Statement:
Executing Virtuoso goals via Jenkins requires a structured and efficient automation process. However, users often face challenges in configuring their Jenkins pipeline scripts correctly to ensure seamless execution. Issues such as improper authentication handling, misconfigured environment variables, and ineffective file management can lead to failures in executing Virtuoso tests. A well-structured and alternative Jenkins pipeline script is needed to address these challenges by providing a reliable approach that automates the execution of Virtuoso goals while maintaining proper cleanup, download, and configuration of execution files.
Solution:
The following Jenkins pipeline script provides an alternative approach to executing goals in Virtuoso. It follows a structured process, ensuring that execution files are cleaned, downloaded, and properly configured before running the test.
Script:
pipeline {
agent any
environment {
VIRTUOSO_API_URL = "https://api.virtuoso.qa/api"
GIT_BASH_PATH = "C:/Program Files/Git/bin/bash.exe" // Path to Git Bash
GOAL_ID = 12345 // Replace with your specific Goal ID
}
stages {
stage("Run Virtuoso Journey") {
steps {
withCredentials([string(credentialsId: 'VirtuosoRun', variable: 'VIRTUOSO_TOKEN')]) {
echo "Starting Virtuoso journey pipeline..."
echo "Step 1: Cleaning up previous execution files..."
bat "\"${GIT_BASH_PATH}\" -c 'rm -f execute.*'"
echo "Step 2: Downloading execute.sh script..."
bat "\"${GIT_BASH_PATH}\" -c 'curl -O https://docs.virtuoso.qa/integration/execute.sh'"
echo "Step 3: Listing downloaded files to confirm download..."
bat "\"${GIT_BASH_PATH}\" -c 'ls -l execute.sh'"
echo "Step 4: Making execute.sh executable..."
bat "\"${GIT_BASH_PATH}\" -c 'chmod +x execute.sh'"
echo "Step 5: Confirming execute.sh is executable..."
bat "\"${GIT_BASH_PATH}\" -c 'ls -l execute.sh'"
echo "Step 6: Running execute.sh with Virtuoso API..."
bat "\"${GIT_BASH_PATH}\" ./execute.sh -t '${VIRTUOSO_TOKEN}' --goal_id ${GOAL_ID} --app"
echo "Step 7: Execution completed. Checking results..."
}
}
}
}
}
Key Parameters to Modify:
credentialsId: 'VirtuosoRun'
→ Use the ID for your Virtuoso API token stored in Jenkins credentials.GOAL_ID = 12345
→ Replace with your specific goal ID.--app
→ Modify based on your environment (--app2
for trial environments).
Reference Screenshot:
Example:
- Scenario: If a user wants an alternative way to execute Virtuoso goals via Jenkins.
- Solution: The provided pipeline script ensures a structured execution process with step-by-step logging and validation.
Comments
0 comments
Please sign in to leave a comment.