From aa393d232bc4ee2f60b8c71afa759a2f735278ab Mon Sep 17 00:00:00 2001 From: Gregory Hendrickson Date: Fri, 9 Jun 2023 16:42:24 -0700 Subject: [PATCH] revamp static content. --- Jenkinsfile | 1 - static-html-directory/index.html | 21 ++++++++++++++------- static-html-directory/script.js | 24 ++++++++++++++++++++++++ static-html-directory/styles.css | 27 +++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 static-html-directory/script.js create mode 100644 static-html-directory/styles.css diff --git a/Jenkinsfile b/Jenkinsfile index 6536389..0048556 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,6 @@ pipeline { agent any environment { DOCKERHUB_CREDENTIALS=credentials('dockerhub-cred') - SSH_CREDENTIALS=credentials('ssh-cred') } stages { diff --git a/static-html-directory/index.html b/static-html-directory/index.html index d456592..0171122 100644 --- a/static-html-directory/index.html +++ b/static-html-directory/index.html @@ -1,8 +1,15 @@ + - - Greg Test - -
- Hello World! I was built with jenkins! This is just an extension of content at this point -
- \ No newline at end of file + + Latest Commit + + + +
+

Latest Commit

+
+
+ + + + diff --git a/static-html-directory/script.js b/static-html-directory/script.js new file mode 100644 index 0000000..4adf66a --- /dev/null +++ b/static-html-directory/script.js @@ -0,0 +1,24 @@ +const commitInfoElement = document.getElementById('commit-info'); + +fetch('https://api.github.com/repos/ghndrx/docker-test-image/commits') + .then(response => response.json()) + .then(data => { + if (data.length > 0) { + const latestCommit = data[0]; + const commitMessage = latestCommit.commit.message; + const commitAuthor = latestCommit.commit.author.name; + const commitDate = new Date(latestCommit.commit.author.date).toLocaleString(); + + commitInfoElement.innerHTML = ` +

Message: ${commitMessage}

+

Author: ${commitAuthor}

+

Date: ${commitDate}

+ `; + } else { + commitInfoElement.innerHTML = '

No commits found.

'; + } + }) + .catch(error => { + commitInfoElement.innerHTML = '

Error loading commit information.

'; + console.error(error); + }); diff --git a/static-html-directory/styles.css b/static-html-directory/styles.css new file mode 100644 index 0000000..c27aa48 --- /dev/null +++ b/static-html-directory/styles.css @@ -0,0 +1,27 @@ +body { + font-family: Arial, sans-serif; + background-color: #f3f3f3; + margin: 0; + padding: 0; + } + + .container { + max-width: 800px; + margin: 0 auto; + padding: 20px; + background-color: #fff; + border-radius: 5px; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); + } + + h1 { + text-align: center; + } + + #commit-info { + margin-top: 20px; + padding: 10px; + background-color: #f9f9f9; + border-radius: 5px; + } + \ No newline at end of file