Article Overview:
This article will cover how you can achieve the following:
How to integrate Jenkins with Virtuoso on a Windows environment. Specifically, we will go over:
- Setting up Jenkins credentials for Virtuoso
- Creating and configuring a Jenkins pipeline
- Implementing a sample pipeline script to run Virtuoso tests This guide will streamline the Jenkins and Virtuoso integration process, addressing common issues encountered by Windows users.
Problem Statement:
Many Virtuoso users have encountered difficulties integrating Jenkins pipelines on Windows systems. This often results from the challenge of running Unix-style commands in Jenkins pipelines, which are essential for orchestrating test executions in Virtuoso. Users also face complications when setting up the pipeline environment, particularly with credentials management and configuring the necessary script to trigger test journeys.
Solution:
To overcome these challenges, this guide will provide step-by-step instructions to:
- Install Git Bash to provide a Unix-like environment for executing commands in Jenkins on Windows.
- Set up Jenkins credentials for securely storing the Virtuoso API token.
- Configure a Jenkins pipeline and input the necessary pipeline script for triggering Virtuoso test journeys.
- Execute the pipeline, ensuring successful integration between Jenkins and Virtuoso on a Windows platform.
Example:
Prerequisites:
-
Git Bash Installation:
Download and install Git Bash to provide a Unix-like shell environment on Windows. Git Bash is necessary for running Unix-style commands in Jenkins pipelines on Windows.
Steps to Configure Jenkins Pipeline:
-
Login to Jenkins and Navigate to Credentials:
- Open Jenkins and log in with valid credentials.
- Navigate to Manage Jenkins > Manage Credentials.
-
Add Jenkins Credentials:
- Under the Domains table header, click on "Global."
- Click on “Add Credentials.”
- Fill in the required details:
- Kind: Secret Text
- Secret: Enter the API token from the Virtuoso Dashboard.
-
ID: Name your variable (e.g.,
virtuoso_api_token
). -
Description: This field is optional.
- Click OK to add your credentials to the list.
- Under the Domains table header, click on "Global."
-
Create a New Pipeline:
- Go to the Jenkins Dashboard and click New Item.
- Enter a name for the item and select “Pipeline” as the project type.
- Click OK.
-
Configure the Pipeline:
- The configuration page of your new pipeline will appear.
- Click on Advanced Project Options.
-
Add Pipeline Script:
-
In the pipeline section, paste the following script:
pipeline { agent any environment { VIRTUOSO_API_URL = "https://api.virtuoso.qa/api" VIRTUOSO_TOKEN = credentials('virtuoso_api_token') // Use the ID from Jenkins credentials GOAL_ID = 2619 // Replace with your specific Goal ID GIT_BASH_PATH = "C:/Program Files/Git/bin/bash.exe" // Path to Git Bash } stages { stage("Run virtuoso journey") { steps { bat "\"${GIT_BASH_PATH}\" -c 'rm -f execute.*'" bat "\"${GIT_BASH_PATH}\" -c 'curl -O https://docs.virtuoso.qa/integration/execute.sh'" bat "\"${GIT_BASH_PATH}\" -c 'chmod +x execute.sh'" bat "\"${GIT_BASH_PATH}\" -c './execute.sh -t ${VIRTUOSO_TOKEN} --goal_id ${GOAL_ID} --env'" } } } }
Note:
- Replace the highlighted fields:
- Credentials ID: The name given when adding the Virtuoso Token in Jenkins.
- GOAL_ID: Replace with the specific goal ID you wish to execute.
- The env parameter may need to be updated to “app2” for the Free Trial Environment or removed for the Production environment.
- Replace the highlighted fields:
-
-
Apply and Save:
- Click Apply, and then Save.
- Click Apply, and then Save.
-
Run the Pipeline:
- Once the pipeline is configured, click Build Now. This will execute the configured journey in Virtuoso.
- Once the pipeline is configured, click Build Now. This will execute the configured journey in Virtuoso.
-
View Build Output:
- After successfully completing the configuration, you will see the build console output showing the progress of the journey execution in Virtuoso.
This guide should help resolve issues related to Jenkins and Virtuoso integration for Windows users. By following these steps, users can seamlessly set up and execute their Virtuoso journeys using Jenkins pipelines.
- After successfully completing the configuration, you will see the build console output showing the progress of the journey execution in Virtuoso.
Comments
0 comments
Please sign in to leave a comment.