diff --git a/.gitignore b/.gitignore
index 08c76a1..3ba22a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,10 @@
.vscode
.task
+.pytest*
+site
+__localbuild__
+_out*
+_out/*
+*.pyc
+__pycache__
+.cache
diff --git a/README.md b/README.md
index fe07081..1654385 100644
--- a/README.md
+++ b/README.md
@@ -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
+-
+-
-- [Jenkins Shared Libraries](https://www.jenkins.io/doc/book/pipeline/shared-libraries/)
\ No newline at end of file
+## latest version
+
+-
+
+-
+-
+
+-
+- https://min.io/resources/docs/Spark-S3Select.pdf
\ No newline at end of file
diff --git a/Taskfile.yml b/Taskfile.yml
index 30664c0..c0a0db0 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -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
@@ -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
diff --git a/_cicd/jenlib.build.groovy b/_cicd/jenlib.build.groovy
new file mode 100644
index 0000000..3fe4418
--- /dev/null
+++ b/_cicd/jenlib.build.groovy
@@ -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
+)
diff --git a/_infra/mkdocs_pack/mkdocs.tasks.yml b/_infra/mkdocs_pack/mkdocs.tasks.yml
new file mode 100644
index 0000000..540abd0
--- /dev/null
+++ b/_infra/mkdocs_pack/mkdocs.tasks.yml
@@ -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
diff --git a/_repos/.gitignore b/_repos/.gitignore
new file mode 100644
index 0000000..1b653bd
--- /dev/null
+++ b/_repos/.gitignore
@@ -0,0 +1,4 @@
+*
+*.*
+.*
+!.gitignore
diff --git a/e2e/data4test/_seed_job.pipe.groovy b/data4test/_seed_job.pipe.groovy
similarity index 100%
rename from e2e/data4test/_seed_job.pipe.groovy
rename to data4test/_seed_job.pipe.groovy
diff --git a/data4test/gitlab_seeds/batches/a_simple_batch/Taskfile.yml b/data4test/gitlab_seeds/batches/a_simple_batch/Taskfile.yml
new file mode 100644
index 0000000..3845856
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/a_simple_batch/Taskfile.yml
@@ -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
diff --git a/data4test/gitlab_seeds/batches/a_simple_batch/pipe_500_cmds_minimal.groovy b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_500_cmds_minimal.groovy
new file mode 100644
index 0000000..38ea150
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_500_cmds_minimal.groovy
@@ -0,0 +1,13 @@
+node {
+ stage('start'){
+ sh 'echo START'
+ }
+
+ stage('body'){
+ sh 'find -name "*.groovy"'
+ }
+
+ stage('finis'){
+ sh 'echo FINSH'
+ }
+}
diff --git a/data4test/gitlab_seeds/batches/a_simple_batch/pipe_501_cmds_explicit.groovy b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_501_cmds_explicit.groovy
new file mode 100644
index 0000000..6b74abf
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_501_cmds_explicit.groovy
@@ -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'
+ }
+}
diff --git a/data4test/gitlab_seeds/batches/a_simple_batch/pipe_502_tasks_explicit.groovy b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_502_tasks_explicit.groovy
new file mode 100644
index 0000000..e3a2304
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_502_tasks_explicit.groovy
@@ -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'
+ }
+}
diff --git a/data4test/gitlab_seeds/batches/a_simple_batch/pipe_503_tasks_from_yml.groovy b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_503_tasks_from_yml.groovy
new file mode 100644
index 0000000..21402d7
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/a_simple_batch/pipe_503_tasks_from_yml.groovy
@@ -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'
+ }
+}
diff --git a/data4test/gitlab_seeds/batches/c_complex_batch/Taskfile.yml b/data4test/gitlab_seeds/batches/c_complex_batch/Taskfile.yml
new file mode 100644
index 0000000..6ae3f53
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/c_complex_batch/Taskfile.yml
@@ -0,0 +1,71 @@
+version: "3"
+output: prefixed
+
+tasks:
+
+ build_with_config: &_ref_build_with_config
+ desc: _
+ cmds:
+ - echo build with A={{.A}} B={{.B}} of {{.TASK}}
+
+ build:cfg1:
+ <<: *_ref_build_with_config
+ vars:
+ A: 1
+ B: 2
+
+ build:cfg2:
+ <<: *_ref_build_with_config
+ vars:
+ A: 0
+ B: 555
+
+ build-p:
+ desc: _
+ deps:
+ - build:cfg1
+ - build:cfg2
+ cmds:
+ - echo aggregate
+
+
+ test_with_config: &_ref_test_with_config
+ desc: _
+ cmds:
+ - echo test with A={{.A}} B={{.B}} of {{.TASK}}
+
+ test:cfg1:
+ <<: *_ref_test_with_config
+ vars:
+ A: 0
+ B: 555
+ test:cfg2:
+ <<: *_ref_test_with_config
+ vars:
+ A: 3
+ B: 777777
+ test:cfg3:
+ <<: *_ref_test_with_config
+ vars:
+ A: 3434
+ B: 767
+
+ test-p:
+ desc: _
+ deps:
+ - test:cfg1
+ - test:cfg2
+ - test:cfg3
+ cmds:
+ - echo aggregate
+
+ start: echo start
+ finish: echo finish
+
+ ci-flow:
+ desc: _
+ cmds:
+ - task start
+ - task build-p
+ - task test-p
+ - task finish
\ No newline at end of file
diff --git a/data4test/gitlab_seeds/batches/c_complex_batch/pipe_701_complex_pipes.groovy b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_701_complex_pipes.groovy
new file mode 100644
index 0000000..1c1b14e
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_701_complex_pipes.groovy
@@ -0,0 +1,89 @@
+
+
+def kwj = [
+ 'scmvars': null,
+]
+
+node {
+ stage('BigStage1'){
+ sh 'echo ok'
+ }
+ stage('BigStage2'){
+ parallel (
+ 'cfg1': {
+ stage('fok1'){
+ sh 'echo fok1'
+ }
+ stage('fok2'){
+ sh 'echo fok2'
+ }
+ },
+ 'cfg2': {
+ stage('wewill'){
+ echo 'NN'
+ }
+ stage('wedo'){
+ echo 'NS'
+ parallel (
+ 'wedo:honne': {
+ stage('wedo:hhhhh'){
+ sh 'echo gsfok1'
+ }
+ stage('wedo:bbbbbb'){
+ sh 'echo gsfok1'
+ }
+ },
+ 'wedo:twiter':{
+ stage('wedo:ggaaaggg'){
+ sh 'echo skfok2'
+ }
+ }
+ )
+ }
+ stage('wedone'){
+ echo 'NN'
+ }
+ },
+ 'cfg3': {
+ stage('h234234'){
+ echo 'NN'
+ }
+ stage('s23423'){
+ echo 'NS'
+ // parallel (
+ // 'g': {
+ // sh 'echo gsfok1'
+ // },
+ // 'k':{
+ // sh 'echo skfok2'
+ // }
+ // )
+ }
+ }
+ )
+ }
+ stage('middle'){
+ echo 'NN'
+ }
+ stage('more'){
+ echo 'NS'
+ parallel (
+ 'honne1': {
+ stage('dsdfh12'){
+ sh 'echo gsfok1'
+ }
+ stage('dsfffj12'){
+ sh 'echo gsfok1'
+ }
+ },
+ 'twiter1':{
+ stage('hjkhju12'){
+ sh 'echo skfok2'
+ }
+ }
+ )
+ }
+ stage('report'){
+ echo 'NN'
+ }
+}
\ No newline at end of file
diff --git a/data4test/gitlab_seeds/batches/c_complex_batch/pipe_703_tasks_from_yml.groovy b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_703_tasks_from_yml.groovy
new file mode 100644
index 0000000..9a28fc2
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_703_tasks_from_yml.groovy
@@ -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/c_complex_batch'){
+ jen.step_stages_from_tasks(
+ kwj, '.' ,'Taskfile.yml', 'ci-flow'
+ )
+ }
+
+ stage('finis'){
+ sh 'echo FINSH'
+ }
+}
diff --git a/data4test/gitlab_seeds/batches/c_complex_batch/pipe_730_groovy_dynamic.groovy b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_730_groovy_dynamic.groovy
new file mode 100644
index 0000000..c009b74
--- /dev/null
+++ b/data4test/gitlab_seeds/batches/c_complex_batch/pipe_730_groovy_dynamic.groovy
@@ -0,0 +1,24 @@
+def kwj = [:]
+
+def LBUILD_DIR='__localbuild__/sambuild'
+def LART_NAME='art.tar'
+
+node {
+ stage('start'){
+ sh 'echo START'
+ kwj.scmvars = checkout scm
+ }
+
+ stage('finis'){
+ sh 'echo FINSH'
+ def res = evaluate 'def test() { "eval EVALTEST" }; return test()'
+ echo res
+ }
+ evaluate """
+ stage('ini'){
+ sh 'echo INI'
+ def res = evaluate 'def test() { "eval INCEPTION" }; return test()'
+ echo res
+ }
+ """
+}
diff --git a/data4test/gitlab_seeds/jobs-defs/gitlab_job_dsl.groovy b/data4test/gitlab_seeds/jobs-defs/gitlab_job_dsl.groovy
new file mode 100644
index 0000000..e86ff57
--- /dev/null
+++ b/data4test/gitlab_seeds/jobs-defs/gitlab_job_dsl.groovy
@@ -0,0 +1,119 @@
+private boolean isSandbox() {
+ def locationConfig = jenkins.model.JenkinsLocationConfiguration.get()
+ if (locationConfig != null && locationConfig.getUrl() != null) {
+ locationConfig.getUrl().contains("staging")
+ } else {
+ System.getenv("ENVIRONMENT") == "sandbox"
+ }
+}
+
+List