Skip to content

Commit

Permalink
ref(15): Test a basic wild pipeline on Jenkins (#16)
Browse files Browse the repository at this point in the history
Non functional tests - will deal with that later
  • Loading branch information
jeanjerome authored Aug 29, 2023
1 parent 6f6b222 commit df09f0f
Show file tree
Hide file tree
Showing 47 changed files with 4,436 additions and 810 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# shellcheck disable=SC2148 disable=SC2034
CODECOV_TOKEN="<YOUR_CODECOV_TOKEN>"
GITHUB_TOKEN="<YOUR_GITHUB_TOKEN>"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
/openssl/
/report/
/run/
/test/gitlab/home/
/test/jenkins/home/
/test/jenkins/config/secrets.properties
/test/jenkins/config/exported-jenkins.yaml
/tmp/
.DS_Store
.env
/test/jenkins/home/
6 changes: 6 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library identifier: "wild@15-test-wild-on-jenkins", retriever: modernSCM(
[$class: 'GitSCMSource',
remote: 'https://github.com/scalastic/wild.git',
credentialsId: 'wild-github-token']) _

wildPipeline()
59 changes: 0 additions & 59 deletions config/action-schema.json

This file was deleted.

16 changes: 10 additions & 6 deletions config/json-schema/workflow-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"description": "Version of the workflow, following the SemVer format",
"type": "string"
},
"workflow": {
"actions": {
"description": "The sequence of consecutive actions",
"type": "array",
"items": {
"actions": {
"type": "object",
"properties": {
"action": {
Expand All @@ -32,7 +32,7 @@
}
}
},
"required": ["id", "name", "workflow"],
"required": ["id", "name", "version", "actions"],
"definitions": {
"action": {
"type": "object",
Expand All @@ -45,12 +45,16 @@
"description": "Name of the action",
"type": "string"
},
"action": {
"description": "The action defined in a Bash script file",
"container": {
"description": "Container where to execute the action",
"type": "string"
},
"script": {
"description": "The Bash script filename defining the action",
"type": "string"
}
},
"required": ["id", "name", "action"]
"required": ["id", "name", "container", "script"]
}
}
}
29 changes: 29 additions & 0 deletions config/k8s/containers-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
container:
- name: "bash"
image: "redhat/ubi9"
command: "cat"
tty: true
resources:
cpu:
limit: "500m"
request: "100m"
memory:
limit: "512Mi"
request: "128Mi"
securityContext:
runAsUser: 1000
runAsNonRoot: true
- name: "maven"
image: "maven:3"
command: "cat"
tty: true
resources:
cpu:
limit: "1"
request: "500m"
memory:
limit: "1Gi"
request: "512Mi"
securityContext:
runAsUser: 1000
runAsNonRoot: true
17 changes: 17 additions & 0 deletions config/k8s/containers-init.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
metadata:
labels:
pipeline: jenkinsfile
spec:
containers:
- name: 'wild'
image: scalastic/wild
command:
- cat
tty: true
resources:
requests:
cpu: "0.1"
memory: "128Mi"
limits:
cpu: "0.5"
memory: "512Mi"
30 changes: 0 additions & 30 deletions config/project.sh

This file was deleted.

64 changes: 0 additions & 64 deletions config/sequence-default.json

This file was deleted.

38 changes: 6 additions & 32 deletions config/workflow-action.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
{
"id": "workflow123",
"name": "My Workflow",
"workflow": [
"id": "wild-test-001",
"name": "Sample Workflow for Testing",
"version": "1.0.0",
"actions": [
{
"id": "action1",
"name": "Action 1",
"condition": true,
"action": "do_something",
"pre_action": {
"id": "pre-action1",
"name": "Pre-Action",
"action": "pre_do_something"
},
"post_action": {
"id": "post-action1",
"name": "Post-Action",
"action": "post_do_something"
},
"resume": false,
"log": true,
"log_level": "info"
},
{
"id": "action2",
"name": "Action 2",
"condition": true,
"action": "do_something_else",
"log": true
},
{
"id": "action3",
"name": "Action 3",
"condition": false,
"action": "do_something_else",
"log": false
"container": "bash",
"script": "test/action/bash-version.sh"
}
]
}
19 changes: 19 additions & 0 deletions config/workflow-default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "wild-test-001",
"name": "Sample Workflow for Testing",
"version": "1.0.0",
"actions": [
{
"id": "action1",
"name": "Action 1",
"container": "bash",
"script": "test/action/bash-version.sh"
},
{
"id": "action2",
"name": "Action 2",
"container": "maven",
"script": "test/action/maven-version.sh"
}
]
}
3 changes: 3 additions & 0 deletions docker/basic/alpine/Dockerfile.01
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch
ADD bash
ENTRYPOINT ['/bash']
7 changes: 7 additions & 0 deletions docker/basic/alpine/Dockerfile.02
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM bash:latest

LABEL Author="wild by scalastic"

RUN apk update \
&& apk add --no-cache curl jq \
&& rm -rf /var/cache/apk/*
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM alpine:3.17
FROM alpine:latest

LABEL Author="wid.sh"
LABEL Author="wild by scalastic"

# make sure the package repository is up to date
RUN set -ex \
# Create a non-root user
&& addgroup --system --gid 1001 appgroup \
&& adduser --system --uid 1001 -G appgroup --no-create-home appuser \
&& adduser --system --uid 1000 -G appgroup --shell /bin/bash appuser \
# Upgrade the package index and install security upgrades
&& apk update \
&& apk upgrade \
Expand Down
4 changes: 2 additions & 2 deletions docker/basic/scratch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.17 as downloader
FROM alpine:latest as downloader

ENV JQ_VERSION jq-1.6/jq-linux64
LABEL Author="wid.sh"
LABEL Author="wild by scalastic"

RUN apk add --no-cache curl ca-certificates

Expand Down
5 changes: 5 additions & 0 deletions docker/basic/ubi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM redhat/ubi9:9.2

LABEL Author="WILD by Scalastic"

RUN yum install jq -y
2 changes: 1 addition & 1 deletion docker/build-all-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -euo pipefail

docker build -t scalastic/wild:latest "${WID_CWD}"/docker/basic/scratch/
docker build -t scalastic/wild:latest "./docker/basic/ubi/"

docker push scalastic/wild:latest
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ test:
shellspec -s bash

dev:
shellspec -s bash spec/**/tooling_spec.sh
shellspec -s bash spec/**/workflow_spec.sh
Loading

0 comments on commit df09f0f

Please sign in to comment.