1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
Commit Graph

66 Commits

Author SHA1 Message Date
Marcus Holl
d76246d781
dockerExecuteOnKubernetes: return result of body closure (#4301) 2023-03-27 09:42:04 +02:00
Marcus Holl
b0f578a5a9
dockerExecuteOnKubernetes: log the first two level of the file system in verbose mode (#4293) 2023-03-23 09:27:13 +01:00
Marcus Holl
b835498449
invalidate default stash only if it has been created (#4273) 2023-03-17 08:52:00 +01:00
Oliver Nocon
74cc828221
chore!: improve performance on Kubernetes (#3932)
* chore: test stashBack excludes

* improve logging

* chore!: improve performance on Kubernetes

* update stash pattern

* update test

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2022-08-15 12:55:51 +02:00
Thorsten Duda
014739451b
add annotations (#3207)
* add annotations

* adding utils

* fix test

Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
2021-11-02 10:00:38 +01:00
Pavel Busko
28e0905964
fix(dockerExecuteOnKubernetes) print the error cause if unstash failed and always invalidate (#3142)
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
2021-10-06 10:25:50 +02:00
Jesse Awan
3b2e7dc53d
add initContainer capabilities (#2820)
* set init container capabilities

* set init container capabilities

* correct parameter definition + change assertThat

Co-authored-by: Adnan Awan <adnan.awan@sap.com>
Co-authored-by: Thorsten Duda <thorsten.duda@sap.com>
2021-06-01 09:59:49 +02:00
Oliver Feldmann
d766f6befe
dockerExecuteOnKubernetes: Add capability for volume mounts (#2784)
* Remove unused container variable

* Add volume mounts functionality

* Make volume mounts optional

* Replace placeholder with {}

* Don't provide sidecar volume mounts

* Remove unnecessary parameter volumeName

* Add documentation for new parameter

* Use empty map for {}

* Update vars/dockerExecuteOnKubernetes.groovy

Co-authored-by: Srinikitha Kondreddy <srinikitha.kondreddy@sap.com>

* Improve documentation

Co-authored-by: Srinikitha Kondreddy <srinikitha.kondreddy@sap.com>
2021-04-29 11:39:34 +02:00
Marcus Holl
c53d5241cb
use v6 version of ppiper/cf-cli consistently for all go steps (#2569) 2021-02-11 09:31:25 +01:00
Oliver Feldmann
741b49140e
Move pull image parameters to general section (#2478)
* Move pull image parameters to general section

* Allow no nesting override

* Test dockerPullImage can be set to true

As the default is false, we need to make sure it can still be set to true.
2021-01-13 10:48:48 +01:00
Marcus Holl
b2b4278b34
Provide Additional pod properties for dockerExecuteOnKubernetes (#2051)
Provide additional pod properties for dockerExecuteOnKubernetes

Co-authored-by: Kay Wegner <kay.wegner@sap.com>
2020-10-02 12:56:16 +02:00
Christopher Fenner
b219fb6514
fix(typo): found by misspell (#2064)
* fix typos in step yamls

* fix typos in go files

* regenerate step code

* fix typos in md files

* fix typos in groovy files

* fix further typos
2020-09-24 07:41:06 +02:00
Marcus Holl
da147b16ce
dockerExecuteOnKubernetes: Make container limits configurable (#1993)
dockerExecuteOnKubernetes: Make container limits configurable
2020-09-23 13:08:43 +02:00
Stephan Aßmus
8169d56ef7
Groovy: Load step defaults also from stages section in defaults (#1943)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-08-26 15:32:58 +02:00
Gabriel Borges
4e73a699c2
doc(kubernetes): Make plugin link clickable (#1657)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-06-15 07:03:53 +02:00
Stephan Aßmus
56699ab019
Run artifactPrepareVersion in maven container if necessary (#1634)
* The metadata for artifactPrepareVersion-go specifies a container for when the buildTool is maven.
* The alias to 'mavenExecute' was removed. The problem with this is that when a section containers is included in the metadata, dockerImage will always be picked up from mavenExecute, the conditional dependency on buildTool will not even be considered. Parameters such as m2Path, projectSettingsFile and globalSettingsFile should be configured in general/maven if necessary.
* When the step ends up being executed within dockerExecuteOnKubernetes, we need to preserve the .git folder. This folder would normally be excluded by the default excludes of the stash step. There was already a comment that suppressing this behavior by passing useDefaultExcludes: false was problematic (unfortunately without going into details), so I've added a new parameter to dockerExecute and dockerExecuteOnKubernetes named stashNoDefaultExcludes (note the reverted meaning to ease preserving the default behavior when this parameter is not provided). This parameter is passed to piperExecuteBin from the artifactPreferVersion groovy wrapper.
2020-06-08 17:08:05 +02:00
Daniel Kurzynski
1c247de9d0
Add option to always run stages in a pod (#1414) 2020-04-17 10:31:04 +02:00
Daniel Kurzynski
b32214ee78
Inherit from Kubernetes pod template (#1361) 2020-04-08 19:54:06 +02:00
Daniel Kurzynski
6bd259e5d4
Fix sidecar env vars (#1292) 2020-03-20 11:36:16 +01:00
Sven Merk
b43f331fad
Avoid NotSerializableException #3 (#1252) 2020-03-06 14:05:14 +01:00
Sven Merk
d29c249e35
Avoid using Iterators to get around NotSerializableException (#1242)
* Avoid using Iterators to get around NotSerializableException

* Avoid using Iterators to get around NotSerializableException
2020-03-05 15:48:05 +01:00
Christopher Fenner
a79fd95fd8
fix: correct jenkinsKubernetes parameter exposure & docs (#721)
* remove jenkinsKubernetes parameter
2020-02-04 08:02:38 +01:00
Marcus Holl
767575e75c
Revert "Don't swallow Exception happening inside dockerExecOnK8S.stashWorkspace (#1071)" (#1074)
This reverts commit e64895e022.
2019-12-18 14:53:38 +01:00
Marcus Holl
e64895e022
Don't swallow Exception happening inside dockerExecOnK8S.stashWorkspace (#1071) 2019-12-18 10:07:16 +01:00
Christopher Fenner
57ae0e8f8d
fix(kubernetes): invalidate stashes after usage (#1064)
* fix(kubernetes): invalidate stashes after usage

fixes #1057

* adjust test case
2019-12-17 15:10:57 +01:00
Daniel Kurzynski
462c293c9c User piper docker images (#920) 2019-10-25 17:49:54 +02:00
Marcus Holl
3046f121c1
Check against containerMap from config rather than params (#835)
The parameter map is directly handed over from outside into the step via signature of the call method.

The container map is defined as step parameters, not as parameter handed over (only) via the parameters map.

With the current approach only the container map from the parameters is taken into account. In case the
parametersMap is defined elsewhere it is not taken into account.
2019-10-23 14:31:49 +02:00
Florian Geckeler
565ac99742 Handle sidecar parameters in dockerExecuteOnKubernetes (#869) 2019-09-12 10:52:05 +02:00
Hans Schulz
8cb5779f5d Fix imagePullPolicy always being IfNotPresent when executing single container (#834)
* Update dockerExecuteOnKubernetes.groovy

* Update dockerExecuteOnKubernetes.groovy
2019-08-21 15:04:20 +02:00
Oliver Nocon
023f35c0a8
dockerExecuteOnKubernetes - add stashBack configuration (#808)
* dockerExecuteOnKubernetes - add stashBack configuration

For certain cases it is valuable to only bring back some of the files from an execution inside a container back to the workspace.
This is now added.

Closes #753

* refactor according to PR review
2019-08-14 16:44:12 +02:00
Oliver Nocon
be33eccbec
Take proper jnlp image as default for Kubernetes execution (#759)
* Take proper jnlp image as default for Kubernetes execution

Following changes are contained:

* removal of custom jnlp image as default
* allow customization of jnlp image via system environment

fixes #757

* add documentation
2019-07-17 12:01:24 +02:00
Oliver Nocon
3e46254701
dockerExecuteOnKubernetes - hide sensitive information (#733)
* dockerExecuteOnKubernetes - hide yaml by default
* hide step parameters to not leak sensitive parameter values into the log
* add more details to log output
2019-06-26 08:38:47 +02:00
Oliver Nocon
d66607c31a
dockerExecuteOnKubernetes - support nodeSelector (#747)
support nodeSelector to run on dedicated nodes inside the Kubernetes cluster if required.
2019-06-19 12:26:16 +02:00
Oliver Nocon
e7cbf02b8e
dockerExecuteOnKubernetes - revert #739 (#745)
stashing .git directory had negative side-effects.
Solution would be to stash `.git` folder and unstash in `dockerExecuteOnKubernetes` only if required for a dedicated scenario.
2019-06-06 17:22:25 +02:00
Oliver Nocon
121b23fdaa
dockerExecuteOnKubernetes - stash also .git folder (#739)
Make sure that complete workspace is available in Kubernetes Pod.
So far e.g. git repository information were missing.
2019-06-05 11:24:32 +02:00
Oliver Nocon
4b02143ba3
Merge branch 'master' into pr/noCachedWorkspaceStashes 2019-04-12 11:59:31 +02:00
Oliver Nocon
35ced01ffa
Avoid unwanted behavior when using resilience options (#650)
Certain steps should always fail, even though resilience option `failOnError=false` is used.

* Docker execution typically happens in another step. We should not hide errors here but rather handle their resilience in the step which uses `dockerExecute` and `dockerExecuteOnKubernetes`.
* Wrapper steps like `pipelineExecute`, `pipelineRestartSteps` should not hide errors. If an error occured this has to be considered as **intentional** and not hidden accidentially in case resilience option is switched on.
2019-04-08 20:10:54 +02:00
Marcus Holl
a011c67d09 No update to the stash content list from dockerExecuteOnK8S
When dealing with stashes in dockerExecuteOnKubernetes the global
stash list was updated from the step. This resulted in stashes
transported between the steps, which in turn resulted in having
old stashes unstashed in a pod later down the build. E.g.: mtaBuild
followed by neoDeploy: mtaBuild created a stash, the stash was
rememebered in the default stash list and re-used later on by
neoDeploy. Since the stash was created before the mtaBuild the
deployable was missing in the step.
2019-04-03 13:38:43 +02:00
Sven Merk
1fe05b8a56
Merge branch 'master' into whitesource-step 2019-04-03 12:19:34 +02:00
Holger Partsch
025ce5a88e Don't use host port (#579)
* Stop using host ports

* Sort parameters alphabetically

* Fix warning format
2019-04-02 14:23:19 +02:00
Sven Merk
ae083f5aa7
Merge branch 'master' into whitesource-step 2019-03-27 09:32:05 +01:00
weloli
519a5d6384 web analytics: add reporting for dockerExecute and dockerExecuteOnKubernetes (#516)
web analytics: add reporting for dockerExecute and dockerExecuteOnKubernetes
2019-03-26 17:06:34 +01:00
Sven Merk
a7f257dfe3 Fix missing reference 2019-03-22 12:11:20 +01:00
Holger Partsch
94957e2b54 Make K8S integration more configurable (#552)
* Define pod using k8s yaml manifest

The Kubernetes plugin allows to define pods directly via the Kubernetes
API specification:
https://github.com/jenkinsci/kubernetes-plugin#using-yaml-to-define-pod-templates

This has the advantage of unlocking Kubernetes features which are not
exposed via the Kubernetes plugin, including all Kubernetes security
featues.

Using the Kubernetes API directly is also better from development
point of view because it is stable and better desgined then the API the
plugin offers.

* Make the Kubernetes ns configurable

If one Jenkins Master is used by multiple Teams, it is desirable to
schedule K8S workloads in seperatae workspaces.

* Add securityContext to define uid and fsGroup

In the context of the Jenkins k8s plugin it is uids and fsGroups play an
important role, because the containers share a common file system.

Therefore it is benefical to configure this data centraly.

* fix indention

* Undo format changes

* Extend and fix unit tests

* Fix port mapping

* Don't set uid globally

This does not work with jaas due to permissions problems.

* Fix sidecar test

* Make security context configurable at stage level

* Extract json serialization

* Cleanup unit tests
2019-03-20 10:07:37 +01:00
Christopher Fenner
3f12015364
dockerExecuteOnKubernetes: generate documentation (#487)
* fix whitespace

* correct key order

* add docs annotation

* add key documentation

* remove generated documentation

* fix code climate finding
2019-02-08 12:20:45 +01:00
Marcus Holl
1b202f879a Provide flag for skipping docker image pulls (#407)
* Provide flag for skipping docker image pulls

Usefull for testing while developing images. Without pulling images it is possible to
use images available in the local registry only.
2019-02-06 08:48:33 +01:00
Oliver Nocon
dde4e0abef
Fix regression introduced with #474 (#483)
Fix stashing behavior to include all files in workspace.
This was for example an issue for PR-voting in Docker pipeline since `Dockerfile` has been excluded from stashing
2019-02-05 09:07:47 +01:00
Christopher Fenner
ba2e83c76a
dockerExecuteOnKubernetes: correct parameter keys (#475)
* Update dockerExecuteOnKubernetes.groovy

* Update dockerExecute.groovy

* Update dockerExecuteOnKubernetes.groovy
2019-02-04 09:03:58 +01:00
Oliver Nocon
3b2e42c74f
Add step containerExecuteStructureTest (#441)
* add step containerExecuteStructureTest
* include PR-review feedback
* documentation
2019-01-31 09:39:13 +01:00
Christopher Fenner
fbb9cbeb3c
Update dockerExecuteOnKubernetes.groovy (#474) 2019-01-31 08:49:31 +01:00