From b93486036f1ec89bc18d1eb07a61410fe721b157 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Tue, 25 Feb 2020 17:09:52 +0800 Subject: [PATCH 1/7] new file: Dockerfile new file: Jenkinsfile new file: run.sh Initial commit --- Dockerfile | 24 ++++++++++++++++++++++++ Jenkinsfile | 26 ++++++++++++++++++++++++++ run.sh | 17 +++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..19a0266 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Base on latest (edge) alpine image +FROM node:10-alpine +MAINTAINER Sven Fischer + +WORKDIR /src + +RUN apk add --no-cache --virtual .build-deps \ + git python make g++ \ + && apk add --no-cache openssh-client \ + && git clone https://github.com/krishnasrinivas/wetty --branch v1.1.4 /src \ + && npm install \ + && apk del .build-deps \ + && adduser -h /src -D term \ + && npm run-script build + +ADD run.sh /src + +# Default ENV params used by wetty +ENV REMOTE_SSH_SERVER=127.0.0.1 \ + REMOTE_SSH_PORT=22 + +EXPOSE 3000 + +ENTRYPOINT "./run.sh" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c442187 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +node("docker-node") { + docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { + + git branch: "3.11.3", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-alpine-wetty", credentialsId: 'jenkins-to-git' + + sh "git rev-parse HEAD > .git/commit-id" + def commit_id = readFile('.git/commit-id').trim() + println commit_id + + try { + stage "build" + def app = docker.build "library/x86_64/alpine/wetty" + + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("latest") + + stage('Deploy on K8s'){ + sh "/usr/local/bin/kubectl -n utils delete po --all" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } + } +} diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..a50a2a5 --- /dev/null +++ b/run.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ "x${BASE}" == "x" ]; then + BASE="/" +fi + +if [ "x${REMOTE_SSH_SERVER}" == "x" ]; then + # Login mode, no SSH_SERVER + npm start -- -p 3000 +else + # SSH connect mode + cmd="npm start -- -p 3000 --sshhost ${REMOTE_SSH_SERVER} --sshport ${REMOTE_SSH_PORT} --base ${BASE}" + if ! [ "x${REMOTE_SSH_USER}" == "x" ]; then + cmd="${cmd} --sshuser ${REMOTE_SSH_USER}" + fi + su -c "${cmd}" term +fi From 4992b5ffc46bb68ea9cdb4946ef3f7a697dd4ad2 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Tue, 25 Feb 2020 17:17:57 +0800 Subject: [PATCH 2/7] modified: run.sh Changed permissions on run script file --- run.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 run.sh diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 From d05ab1022342fd0f820e43b6ffda9d90b72dfe0d Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Thu, 2 Apr 2020 15:51:05 +0800 Subject: [PATCH 3/7] modified: Dockerfile modified: Jenkinsfile Updated to wetty 1.3.0 --- Dockerfile | 2 +- Jenkinsfile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19a0266..e50feec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /src RUN apk add --no-cache --virtual .build-deps \ git python make g++ \ && apk add --no-cache openssh-client \ - && git clone https://github.com/krishnasrinivas/wetty --branch v1.1.4 /src \ + && git clone https://github.com/krishnasrinivas/wetty --branch v1.3.0 /src \ && npm install \ && apk del .build-deps \ && adduser -h /src -D term \ diff --git a/Jenkinsfile b/Jenkinsfile index c442187..67eedb0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,9 +14,11 @@ node("docker-node") { stage "publish" app.push("${env.BUILD_NUMBER}") app.push("latest") + app.push("1.3.0") + app.push("1.3") stage('Deploy on K8s'){ - sh "/usr/local/bin/kubectl -n utils delete po --all" + sh "/usr/local/bin/kubectl -n wetty delete po --all" } } catch (err) { From c6b6789a34908171edafaba3760bac3ccd07bdb4 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Thu, 28 May 2020 18:40:13 +0800 Subject: [PATCH 4/7] modified: Dockerfile modified: Jenkinsfile Updated to use master branch --- Dockerfile | 2 +- Jenkinsfile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e50feec..d5ba588 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /src RUN apk add --no-cache --virtual .build-deps \ git python make g++ \ && apk add --no-cache openssh-client \ - && git clone https://github.com/krishnasrinivas/wetty --branch v1.3.0 /src \ + && git clone https://github.com/krishnasrinivas/wetty --branch master /src \ && npm install \ && apk del .build-deps \ && adduser -h /src -D term \ diff --git a/Jenkinsfile b/Jenkinsfile index 67eedb0..033c346 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,7 @@ node("docker-node") { stage "publish" app.push("${env.BUILD_NUMBER}") app.push("latest") - app.push("1.3.0") - app.push("1.3") + app.push("master") stage('Deploy on K8s'){ sh "/usr/local/bin/kubectl -n wetty delete po --all" From 8940ebf29afe2bc1077202c52e4588c8abb6dee6 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Tue, 9 Jun 2020 21:31:32 +0800 Subject: [PATCH 5/7] modified: README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f55bac6..2d1ae37 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # x86_64-alpine-wetty -weTTY running on Alpine Linux container image -Configured to connect to specified server name via environment variable (taken from https://github.com/svenihoney/docker-wetty-alpine) \ No newline at end of file +weTTY running on Alpine Linux container image +Configured to connect to specified server name via environment variable (taken from https://github.com/svenihoney/docker-wetty-alpine) From b432da8d2144f70ba0dad6206635446c506938a6 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Tue, 9 Jun 2020 22:02:19 +0800 Subject: [PATCH 6/7] modified: Jenkinsfile Fixed git address --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 033c346..f6e15ab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ node("docker-node") { docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { - git branch: "3.11.3", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-alpine-wetty", credentialsId: 'jenkins-to-git' + git branch: "3.11.3", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-wetty", credentialsId: 'jenkins-to-git' sh "git rev-parse HEAD > .git/commit-id" def commit_id = readFile('.git/commit-id').trim() From c63f5881623bbb0caa1f1089a80522ff5a63b1d3 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Mon, 6 Jul 2020 15:46:46 +0800 Subject: [PATCH 7/7] Added version tag --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index f6e15ab..c8adf9c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,7 @@ node("docker-node") { app.push("${env.BUILD_NUMBER}") app.push("latest") app.push("master") + app.push("1.3") stage('Deploy on K8s'){ sh "/usr/local/bin/kubectl -n wetty delete po --all"