commit message from python script

This commit is contained in:
2023-05-03 20:00:02 +02:00
parent f35f1a86ac
commit b42b7c3869
4 changed files with 60 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import jenkins, os
import xml.etree.ElementTree as ET
#connect
server = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='116a45abc20fff8ae5ac67cdac1d65c687')
server = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='113c3449636622439627ab1d51454fc07c')
user = server.get_whoami()
version = server.get_version()
#vars_für den Job

View File

@@ -8,7 +8,7 @@
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>{git_url}</url>
<credentialsId>4ee2c832-863c-41c3-8f9b-0962c7b8439f</credentialsId>
<credentialsId>e4acf1ed-a858-429d-b5a6-c149431563db</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>

43
jenkins/test_4_config.xml Normal file
View File

@@ -0,0 +1,43 @@
<?xml version='1.1' encoding='UTF-8'?>
<project>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@5.0.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://gitea.schlaubistechtalk.de/JonnyBravo/test_play.git</url>
<credentialsId>e4acf1ed-a858-429d-b5a6-c149431563db</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="empty-list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<hudson.triggers.SCMTrigger>
<spec>H/2 * * * *</spec>
<ignorePostCommitHooks>false</ignorePostCommitHooks>
</hudson.triggers.SCMTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>./test_play.yml</command>
<configuredLocalRules/>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
</project>

View File

@@ -0,0 +1,15 @@
import jenkins
jenkins_client = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='113c3449636622439627ab1d51454fc07c')
# Get all builds
all_jobs = jenkins_client.get_all_jobs()
# Show Job Infos
job_info = jenkins_client.get_job_info(name='test_4')
print(job_info)
# Show Job Name
for job_line in all_jobs:
print(job_line['name'])
# start Job
job_start = jenkins_client.build_job(name='test_4', parameters={'test' : 'test_python'})