summaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
Diffstat (limited to 'manual')
-rw-r--r--manual/jenkins/readme.md16
-rwxr-xr-xmanual/jenkins/setup-periodic-trigger-for-all-jobs.sh57
-rw-r--r--manual/jobs.json (renamed from manual/jenkins/jobs.json)0
-rwxr-xr-xmanual/seed-jobs.sh (renamed from manual/jenkins/seed-jobs.sh)2
4 files changed, 1 insertions, 74 deletions
diff --git a/manual/jenkins/readme.md b/manual/jenkins/readme.md
deleted file mode 100644
index 37a0131..0000000
--- a/manual/jenkins/readme.md
+++ /dev/null
@@ -1,16 +0,0 @@
-Example scripts how to manage Jenkins automatically.
-
-In order to make scripts work you need to create API token update script to use your credentials.
-
-Jenkins setup
---
-
-**User account (click on your username - top-right corner) -> Configure**
-
-**API Token -> Current token(s) -> Add new Token**
-
-```
-Name: CLI
-```
-
--> Generate -> [copy generated key and save it for later use]
diff --git a/manual/jenkins/setup-periodic-trigger-for-all-jobs.sh b/manual/jenkins/setup-periodic-trigger-for-all-jobs.sh
deleted file mode 100755
index 2265a1a..0000000
--- a/manual/jenkins/setup-periodic-trigger-for-all-jobs.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-#
-# This script lists all available jobs
-# then obtains XML definition for each job
-# then modifies XML definition (adds periodic trigger)
-# and at last pushes modified XML definition to Jenkins
-#
-# This may not be useful to you but it shows how to interact with Jenkins in automated way.
-#
-# dependency: apt install xmlstarlet
-#
-
-jenkinsUser="" # fill your username here or set via export JENKINS_USER
-jenkinsToken="" # fill your token here or set via export JENKINS_TOKEN
-jenkinsHost="172.17.17.17:8080"
-workDir="/tmp/jenkins-cli-experiments"
-
-mkdir -p "$workDir"
-
-templatePath="jobTemplate.xml"
-jenkinsUser=${jenkinsUser:-$JENKINS_USER}
-jenkinsToken=${jenkinsToken:-$JENKINS_TOKEN}
-jenkinsUrl="http://${jenkinsUser}:${jenkinsToken}@$jenkinsHost"
-
-get() {
- curl -sS -g "${jenkinsUrl}${1}"
-}
-
-push() {
- curl -sS -g -X POST -d "@${2}" -H "Content-Type: text/xml" "${jenkinsUrl}${1}"
-}
-
-get "/api/xml?tree=jobs[name]" | xmlstarlet sel -t -v "//hudson/job/name" | while read jobName || [ -n "$jobName" ]; do
-
- echo -n "$jobName:"
-
- originalPath="$workDir/$jobName.xml"
- get "/job/$jobName/config.xml" > "$originalPath"
-
- updatedPath="$workDir/${jobName}_updated.xml"
- project="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject"
- trigger="com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger"
- plugin="cloudbees-folder@6.928.v7c780211d66e"
- xmlstarlet ed --delete "//$project/triggers/$trigger" \
- --subnode "//$project/triggers" --type elem --name "$trigger" \
- --append "//$project/triggers/$trigger" --type attr --name plugin --value "$plugin" \
- --subnode "//$project/triggers/$trigger" --type elem --name spec --value "H/15 * * * *" \
- --subnode "//$project/triggers/$trigger" --type elem --name interval --value "3600000" \
- "$originalPath" > "$updatedPath" 2>/dev/null
-
- push "/job/$jobName/config.xml" "$updatedPath"
-
- echo " ok"
-
-done
diff --git a/manual/jenkins/jobs.json b/manual/jobs.json
index 2605b96..2605b96 100644
--- a/manual/jenkins/jobs.json
+++ b/manual/jobs.json
diff --git a/manual/jenkins/seed-jobs.sh b/manual/seed-jobs.sh
index a879e83..0d20ccc 100755
--- a/manual/jenkins/seed-jobs.sh
+++ b/manual/seed-jobs.sh
@@ -34,7 +34,7 @@ workDir="/tmp/seed-jobs"
mkdir -p "$workDir"
-templatePath="jobTemplate.xml"
+templatePath="../jobs/jobTemplate.xml"
jenkinsUser=${jenkinsUser:-$JENKINS_USER}
jenkinsToken=${jenkinsToken:-$JENKINS_TOKEN}
jenkinsUrl="http://${jenkinsUser}:${jenkinsToken}@$jenkinsHost"