Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 96a85a3

Browse files
committed
New: Initial import
1 parent 473ba28 commit 96a85a3

5 files changed

Lines changed: 122 additions & 2 deletions

File tree

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM alpine
2+
3+
RUN apk add --no-cache bash markdown
4+
5+
ADD entrypoint.sh /entrypoint.sh
6+
RUN chmod +x /entrypoint.sh
7+
8+
VOLUME ["/workspace"]
9+
WORKDIR /workspace
10+
ENTRYPOINT ["/entrypoint.sh"]

Jenkinsfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!groovy
2+
3+
@Library('github.com/red-panda-ci/jenkins-pipeline-library@v2.7.0') _
4+
5+
// Initialize global config
6+
cfg = jplConfig('dc-md2html', 'bash', '', [slack: '#integrations', email:'redpandaci+dc-md2html@gmail.com'])
7+
8+
pipeline {
9+
agent none
10+
11+
stages {
12+
stage ('Initialize') {
13+
agent { label 'master' }
14+
steps {
15+
jplStart(cfg)
16+
}
17+
}
18+
stage ('Build') {
19+
agent { label 'docker' }
20+
steps {
21+
script {
22+
jplDockerPush (cfg, "kairops/dc-md2html", "test", ".", "https://registry.hub.docker.com", "cikairos-docker-credentials")
23+
}
24+
}
25+
}
26+
stage ('Test') {
27+
agent { label 'docker' }
28+
steps {
29+
sh 'bin/test.sh'
30+
}
31+
}
32+
stage ('Release confirm') {
33+
when { expression { cfg.BRANCH_NAME.startsWith('release/v') || cfg.BRANCH_NAME.startsWith('hotfix/v') } }
34+
steps {
35+
jplPromoteBuild(cfg)
36+
}
37+
}
38+
stage ('Release finish') {
39+
agent { label 'master' }
40+
when { expression { (cfg.BRANCH_NAME.startsWith('release/v') || cfg.BRANCH_NAME.startsWith('hotfix/v')) && cfg.promoteBuild.enabled } }
41+
steps {
42+
jplDockerPush (cfg, "kairops/dc-md2html", cfg.releaseTag, ".", "https://registry.hub.docker.com", "cikairos-docker-credentials")
43+
jplDockerPush (cfg, "kairops/dc-md2html", "latest", ".", "https://registry.hub.docker.com", "cikairos-docker-credentials")
44+
jplCloseRelease(cfg)
45+
}
46+
}
47+
}
48+
49+
post {
50+
always {
51+
jplPostBuild(cfg)
52+
}
53+
}
54+
55+
options {
56+
timestamps()
57+
ansiColor('xterm')
58+
buildDiscarder(logRotator(artifactNumToKeepStr: '20',artifactDaysToKeepStr: '30'))
59+
disableConcurrentBuilds()
60+
skipDefaultCheckout()
61+
timeout(time: 1, unit: 'DAYS')
62+
}
63+
}

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
# dc-md2html
2-
Docker Command: Markdown to html conversion
1+
# Docker Command: Markdown to HTML file conversion
2+
3+
Convert files from Markdown format to HTML format
4+
5+
Its a part of the Docker Command series
6+
7+
## Usage
8+
9+
Execute the following within your repository folder:
10+
11+
- Using Bash: `entrypoint.sh source.md > target.html` or `cat target.HTML | entrypoint.sh > target.html`
12+
- Using Docker: `docker run --rmi -v $(pwd):/workspace kairops/dc-md2html source.md > target.html`
13+
- Using docker-command-launcher: `kd md2html source.md > target.html`
14+
15+
## Considerations
16+
17+
This function uses the `markdown` package. You could install with:
18+
19+
- Mac: `brew install markdown`
20+
- Linux DEB package: `apt-get install markdown`
21+
- Linux RPM package: `yum install epel-release` + `yum install discount` (`markdown` command)
22+
23+
You can use either `cat source.md | kd md2html > target.html` or `kd md2html source.md > target.html` format

bin/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
echo "Volkswagen test"

entrypoint.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# markdown command check
4+
markdownCMD="$(which markdown)"
5+
if [ "$markdownCMD" == "" ]; then
6+
echo "Missing 'markdown' command. Abort"
7+
exit 1
8+
fi
9+
10+
# Generate HTML from Markdown file if we have it as parameter
11+
if [ "$1" != "" ]; then
12+
if [ -f $1 ]; then
13+
$markdownCMD $1
14+
exit 0
15+
else
16+
echo "File $1 does not exist. Abort"
17+
exit 1
18+
fi
19+
fi
20+
21+
# Generate HTML from standard input
22+
(while read -t 5 line; do
23+
echo $line
24+
done)|$markdownCMD

0 commit comments

Comments
 (0)