Skip to content

feat: Init Agent Intergation #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
*.tar.gz
*.rar

.idea/


# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

target/
work/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
39 changes: 23 additions & 16 deletions example.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
import groovy.json.JsonOutput

pipeline {
agent any

parameters {
string(name: 'JOB_ID', defaultValue: '', description: 'Ctrlplane Job ID')
string(name: 'API_URL', defaultValue: 'https://api.example.com', description: 'API Base URL (optional)')
string(name: 'JOB_ID', defaultValue: '', description: 'Ctrlplane Job ID passed by the plugin')
}

stages {
stage('Deploy') {
stage('Fetch Ctrlplane Job Details') {
steps {
script {
if (!params.JOB_ID) {
error 'JOB_ID parameter is required'
}

def ctrlplane = load 'src/utils/CtrlplaneClient.groovy'
def job = ctrlplane.getJob(
params.JOB_ID,
params.API_URL,
// params.API_KEY
)

if (!job) {
error "Failed to fetch data for job ${params.JOB_ID}"
}

echo "Job status: ${job.id}"
echo "Fetching details for Job ID: ${params.JOB_ID}"

def jobDetails = ctrlplaneGetJob jobId: params.JOB_ID

echo "-----------------------------------------"
echo "Successfully fetched job details:"
echo JsonOutput.prettyPrint(JsonOutput.toJson(jobDetails))
echo "-----------------------------------------"

// Example: Access specific fields from the returned map
// if(jobDetails.variables) {
// echo "Specific Variable: ${jobDetails.variables.your_variable_name}"
// }
// if(jobDetails.metadata) {
// echo "Metadata Value: ${jobDetails.metadata.your_metadata_key}"
// }
// if(jobDetails.job_config) {
// echo "Job Config: ${jobDetails.job_config.jobUrl}"
// }
}
}
}
Expand Down
Loading