     (log "crendetials-id" credentials-id))
 
 (defn send-configuration-xml-to-jenkins
+    "Send the file containing job configuration to Jenkins via its REST API."
     [url config]
     (http-client/post url {
         :body             config

        :trust-store-pass "changeit"}))

(defn get-template
    [metadata-directory metadata]
    (slurp (if metadata (str metadata-directory "/template_with_metadata.xml")
                        (str metadata-directory "/template.xml"))))

(defn create-job
    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch credentials-id metadata-directory metadata]
    (log-operation job-name git-repo branch "create_job" metadata credentials-id)
    (let [template (get-template metadata-directory metadata)

    (job-related-command jenkins-url jenkins-auth include-jenkins-reply? job-name "doDelete"))

(defn replace-placeholder
    "Replace selected placeholder in the template."
    [string placeholder-name value]
    (if value
        (clojure.string/replace string (str "<placeholder id=\"" placeholder-name "\" />") value)
        string))

(defn update-template
    "Update the XML template with job configuration."
    [template git-repo branch metadata credentials-id]
    (-> template
        (replace-placeholder "git-repo"                   git-repo)
