Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
.vscode
.task
.pytest*
site
__localbuild__
_out*
_out/*
*.pyc
__pycache__
.cache
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

Jenlib is Shared

Basic Usage: see [README.md](./var/README.md)
Basic Usage: see docs

## Job DSL
- [index.md](./docs/index.md)

- https://github.com/Ticketfly/jenkins-docker-examples
- https://www.praqma.com/stories/dockerized-jenkins-jobdsl/
- https://github.com/thomasleveil/docker-jenkins-dsl-ready
## Parallel Execution

## References
- <https://joostvdg.github.io/jenkins-pipeline/jenkins-parallel-pipeline/>
- <https://joostvdg.github.io/jenkinsx/build-packs/>

- [Jenkins Shared Libraries](https://www.jenkins.io/doc/book/pipeline/shared-libraries/)
## latest version

- <https://www.digitalocean.com/community/tutorials/how-to-migrate-a-docker-compose-workflow-to-kubernetes>

- <https://medium.com/@karansingh010/running-kubernetes-in-docker-a26f4311fae1>
- <https://callistaenterprise.se/blogg/teknik/2017/12/20/kubernetes-on-docker-in-docker/>

- <https://leetcode.com/problems/longest-word-in-dictionary/>
- https://min.io/resources/docs/Spark-S3Select.pdf
80 changes: 79 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# https://taskfile.dev

version: '2'
version: '3'

includes:
mkdocs: _infra/mkdocs_pack/mkdocs.tasks.yml
jenconda:
taskfile: dockers/jenkins-master/Taskfile.yml
dir: dockers/jenkins-master
e2e: ./tasks/e2e.tasks.yml
# docker: _infra/jenlib_lib/tasks/docker.tasks.yml
# tests: _infra/jenlib_lib/tasks/tests.tasks.yml
# ci: _infra/jenlib_lib/tasks/ci.tasks.yml

vars:
GREETING: Jenlib repo actions
Expand All @@ -12,8 +22,76 @@ tasks:
- task -l
silent: true

info:
desc: Information about this dir
cmds:
- |
echo '
# Jenlib taskfile

## Layout

- `src` - jenkins shared lib 'jenlib'
- `jenpy` (jenlib) - python cli for jenkins, jenlib, gitlab, s3/http access

## Command Groups

This repo is multi product repo
Each product have it's own taskfile
Taskfiles are copied to tasks dir from different ci-libs
Each taskfile express one group

> Available Groups

- jenlib - jenkins shared lib tasks
- docker - jenconda docker build
- mkdocs - documentation
- deps - environment tasks

## Group Commands

Most Groups are


build:
desc: _
cmds:
- echo "There is No build, but lot of tests"

readme:
desc: _
cmds:
- cat README.md | less

build:prepare:
desc: _
cmds:
- rm -rf __localbuild__/jenbuild
- mkdir -p __localbuild__/jenbuild/jenlib
- rclone copyto vars __localbuild__/jenbuild/jenlib/vars
- rclone copyto version/version_prefix.txt __localbuild__/jenbuild/jenlib/version.txt

build:do:
desc: _
dir: __localbuild__/jenbuild/jenlib
cmds:
- zip -r ../jenlib.zip .

publish:build:
desc: _
cmds:
- rclone copyto __localbuild__/jenbuild/jenlib.zip mts3:moneytime-http/buildx/jenlib/jenlib.zip

build:full:
desc: _
cmds:
- task: build:prepare
- task: build:do

full:cycle:
decs: _
cmds:
- task: build:full
- task: publish:build
status:
- true # prevent accidental run
16 changes: 16 additions & 0 deletions _cicd/jenlib.build.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@Library("jenlib@master") _

def kws = [:]

LoadConfig(
kws,
dest: 'jenlib_config'
config_path: "version/jenlib_config.yml",
config_entry: "jenbuild_flow"
)

JenFlowTopLevel(
kws,
taskfile: kws.jenlib_config.jenflow,
taskname: kws.jenlib_config.taskname
)
35 changes: 35 additions & 0 deletions _infra/mkdocs_pack/mkdocs.tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://taskfile.dev
version: '3'

vars:
DIMAGE: "squidfunk/mkdocs-material"
DSERVE_PORT: 8690:8690
DARGS: "-v ${PWD}:/docs"

tasks:
_denv: &_ref__denv
desc: _
# vars:
# TASK_LAST: "{{.TASK | splitList | last}}"
cmds:
- mkdir -p __localbuild__/site && chmod 777 __localbuild__/site
- docker run --rm {{ .DARGS }} {{.DMORE}} {{ .DIMAGE }} {{.DCMD}}

build:
<<: *_ref__denv
vars:
DCMD: build

serve:
<<: *_ref__denv
vars:
DCMD: serve
DMORE: -p {{.DSERVE_PORT}}

shell:
<<: *_ref__denv
vars:
DMORE:
|
-p {{.DSERVE_PORT}} \
-it --entrypoint /bin/sh
4 changes: 4 additions & 0 deletions _repos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
*.*
.*
!.gitignore
File renamed without changes.
44 changes: 44 additions & 0 deletions data4test/gitlab_seeds/batches/a_simple_batch/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# https://taskfile.dev

version: '3'

vars:
GREETING: Hello, World!
LBUILD_DIR: __localbuild__/sambuild
LART_NAME: art.tar

tasks:
default:
cmds:
- echo "{{.GREETING}}"
silent: true

prepare:
desc: prepare for build
cmds:
- rm -rf {{.LBUILD_DIR}}
- mkdir -p {{.LBUILD_DIR}}/bdir
- cp *.yml *.groovy {{.LBUILD_DIR}}/bdir

build:
desc: do the build
dir: "{{.LBUILD_DIR}}/bdir"
cmds:
# - zip -r ../art.zip .
- tar -cvf ../{{.LART_NAME}} .

test:
desc: test artifact
cmds:
- tar -tvf {{.LBUILD_DIR}}/{{.LART_NAME}}
# - unzip -vl {{.LBUILD_DIR}}/art.zip


ci-flow:
desc: full build cycle
jenlib:
ci-flow: body
cmds:
- task prepare
- task build
- task test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node {
stage('start'){
sh 'echo START'
}

stage('body'){
sh 'find -name "*.groovy"'
}

stage('finis'){
sh 'echo FINSH'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
def kwj = [:]

def LBUILD_DIR='__localbuild__/sambuild'
def LART_NAME='art.tar'

node {
stage('start'){
sh 'echo START'
kwj.scmvars = checkout scm
}

dir('data4test/gitlab_seeds/batches/a_simple_batch'){
stage('task prepare'){
sh "rm -rf ${LBUILD_DIR}"
sh "mkdir -p ${LBUILD_DIR}/bdir"
sh "cp *.yml *.groovy ${LBUILD_DIR}/bdir"
}

stage('task build'){
dir("${LBUILD_DIR}/bdir"){
sh "tar -cvf ../${LART_NAME} ."
}
}

stage('task test'){
sh "tar -tvf ${LBUILD_DIR}/${LART_NAME}"
}
}

stage('finis'){
sh 'echo FINSH'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def kwj = [:]

node {
stage('start'){
sh 'echo START'
kwj.scmvars = checkout scm
}
dir('data4test/gitlab_seeds/batches/a_simple_batch'){
stage('task prepare'){
sh 'task prepare'
}

stage('task build'){
sh 'task build'
}

stage('task test'){
sh 'task test'
}
}
stage('finis'){
sh 'echo FINSH'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

library identifier: 'jenlib@0.7.5', retriever: http(
credentialsId: 'asd',
httpURL: 'http://moneytime.yairdar.com/buildx/jenlib/jenlib.zip')

def kwj = [
'scmvars': null,
'task_parse_result': [:],
]

node {

stage('start'){
sh 'echo START'
kwj.scmvars = checkout scm
}

dir('data4test/gitlab_seeds/batches/a_simple_batch'){
jen.step_stages_from_tasks(
kwj, '.' ,'Taskfile.yml', 'ci-flow'
)
}

stage('finis'){
sh 'echo FINSH'
}
}
Loading