-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d3e464
commit 39d19cf
Showing
6 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM alpine:latest | ||
ENV SEQUENCER_VERSION=v2.8 | ||
|
||
RUN apk add --update npm curl jq | ||
|
||
COPY . . | ||
|
||
RUN npm i @scramjet/cli -g | ||
|
||
RUN si seq pack . -o hello.tar.gz | ||
|
||
COPY seq.sh /usr/local/bin/seq.sh | ||
|
||
RUN chmod u+x /usr/local/bin/seq.sh | ||
|
||
ENTRYPOINT [ "/usr/local/bin/seq.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
pipeline { | ||
agent { | ||
node { | ||
label "docker" | ||
} | ||
} | ||
environment { | ||
base_path = "apps-images/sequencer" | ||
} | ||
stages { | ||
stage("Checkout SCM") { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
stage("Build Docker Image") { | ||
steps { | ||
script { | ||
dir("${base_path}") { | ||
image = docker.build("apps/sequencer") | ||
} | ||
} | ||
} | ||
} | ||
stage("Publish Docker") { | ||
// Run only in master branch | ||
when { | ||
branch 'main' | ||
} | ||
steps { | ||
script { | ||
dir("${base_path}") { | ||
def version = sh(returnStdout: true, script: "awk -F= '/^ENV SEQUENCER_VERSION/ {print \$2}' Dockerfile").trim() | ||
docker.withRegistry('https://repo.int.scp.ovh', 'docker-repo') { | ||
image.push("${version}") | ||
image.push("latest") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
// When successed currentBuild.result is null | ||
script { | ||
if (currentBuild.result == null) { | ||
currentBuild.result = 'SUCCESS' | ||
} | ||
} | ||
echo "Cleaning.." | ||
cleanWs() | ||
} | ||
// Slack Notifications syntax: https://www.jenkins.io/doc/pipeline/steps/slack/ | ||
unsuccessful { | ||
script { | ||
// CHANGE_ID is set only for pull requests | ||
if (env.CHANGE_ID) { | ||
slackSend (color: '#FF0000', message: "Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL}) failed.") | ||
} | ||
} | ||
} | ||
fixed { | ||
script { | ||
// CHANGE_ID is set only for pull requests | ||
if (env.CHANGE_ID) { | ||
slackSend (color: '#00FF00', message: "Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL}) back to normal.") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# sequencer | ||
|
||
Docker image for sequencer builded on top of Alpine base image. | ||
|
||
## Build | ||
|
||
```bash | ||
docker build --no-cache -t repo.int.scp.ovh/apps/sequencer:v2.9 . | ||
``` | ||
|
||
## Run | ||
|
||
```bash | ||
docker run -ti sequencer:v2.9 127.0.0.1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { Transform } = require("stream"); | ||
|
||
module.exports = function(input) { | ||
return input.pipe(new Transform({ | ||
encoding: "utf-8", | ||
transform(chunk, _encoding, callback) { | ||
callback(null, `Hello ${chunk}`); | ||
} | ||
})); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@scramjet/hello-bad", | ||
"version": "0.13.1", | ||
"description":"Sequence that modifies incoming stream of strings by saying Hello", | ||
"main": "app.js", | ||
"author": "Scramjet <open-source@scramjet.org>", | ||
"license": "GPL-3.0", | ||
"scripts": { | ||
"build:refapps": "node ../../scripts/build-all.js", | ||
"postbuild:refapps": "yarn prepack && yarn packseq", | ||
"clean": "rm -rf ./dist .bic_cache", | ||
"prepack": "PACKAGES_DIR=js node ../../scripts/publish.js", | ||
"packseq": "PACKAGES_DIR=js node ../../scripts/packsequence.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/scramjetorg/transform-hub.git" | ||
}, | ||
"assets": ["name.txt"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh -x | ||
|
||
if [ "$#" -ne 1 ] | ||
then | ||
echo "Usage: ./seq <multimanager.k8s.example.com|127.0.0.1>" | ||
exit 1 | ||
fi | ||
|
||
echo "Image build from https://github.com/scramjetorg/docker" | ||
mmEndpoint=$1 | ||
|
||
si -v | ||
|
||
si config set log --debug false | ||
si config set log --format json | ||
|
||
#get first managerID | ||
manager=$(curl -s http://$mmEndpoint:11000/api/v1/list |jq -r .[0].id) | ||
if [ -z "$manager" ]; then | ||
echo "No manager found"; | ||
exit 1 | ||
else | ||
echo "manager: $manager" | ||
fi | ||
|
||
# get first healthy STH ID | ||
sth=$(curl -s http://$mmEndpoint:11000/api/v1/cpm/$manager/api/v1/list |jq -r '[.[] | select( .healthy == true )][0].id') | ||
if [ -z "$sth" ]; then | ||
echo "No healthy STH found"; | ||
exit 1 | ||
else | ||
echo "STH: $sth" | ||
fi | ||
|
||
#check if seq exists, if true exit script | ||
seq=$(curl -s http://$mmEndpoint:11000/api/v1/cpm/$manager/api/v1/sth/$sth/api/v1/sequences |jq -r .[0].id) | ||
if [ -z "$seq" ] || [[ "$seq" == 'null' ]]; then | ||
echo "No sequence found, continuing.." | ||
else | ||
echo "Found sequence $seq Exit script." | ||
exit 0 | ||
fi | ||
|
||
#si | ||
si config use apiUrl http://$mmEndpoint:11000/api/v1/cpm/$manager/api/v1/sth/$sth/api/v1 |jq | ||
|
||
si config p |jq | ||
si seq pack . -o hello.tar.gz | ||
si seq send hello.tar.gz |jq |