* Ensure closure gets called when neither returnStdout nor returnStatus are set
In this case we do not have a return value, but in case we execute a closure we should execute the closure.
With that it is possible to raise an exception from the closure.
* [refactoring] unify usage of unify method call
* Remove dead code.
Coding after uncondition throw exception statement does not get executed.
* Ensure script rule behaves the same whan called with string and with map.
Before the test we remmber which test is currently running.
During the test we collect all the calls to steps.
Beside that we persist the names of all steps within this shared
lib itself.
After the test(s) we write a corresponding json file. In fact we
write the file after each test, which is too often. But since we
don't know which test is the last test we can't do better.
The resulting file can be used later on for resolving the plugins
contributing the particular steps.
With that we are able to create a list of required plugins for each
step.
We should try to avoid promting statements to the log during tests. This is basically
some kind of manual/visual checking of conditions. This does not work since in most cases
nobody scans test logs manually/visually. I think this is often a smell for missing assertions.
* Project "Piper" Template: framework and structure
This is the first in a series of Pull-Requests to provide a fully functional Pipeline template into the library.
This PR contains:
* general Pipeline structure incl. tests
* Pipeline initialization incl. tests
* Hollow pipeline stages incl. tests
* first set of default values
* add gitUrls to commonPipelineEnvironment
* set correct git information on commonPipelineEnvironment
The following features were added:
Lock resources for deployment
New parameters: environment, vmArguments
Assert password does not start with @
Link to cloud cockpit
Only execute rolling update if app is running
Show logs if deployment failed
Restart app after normal deployment
Use neo namespace for parameters
Align parameter names with neo sdk: size, application, source
Remove vmSize check as done by the tool itself
* add wrapper for stages contained in library
`piperStageWrapper` provides a wrapper for stages which we may include into the library.
It will take care about extension capabilities, locking, node handling, ... which should be a capability of every stage contained in the library.
* toString is helpful for troubleshooting during developing tests
* equals/hashCode are required in case somebody would like to register
some responses again (e.g. register something valid almost all the time, and
register something more specific for a certain test).
This step allows to restart a set of steps in order to retry in case of e.g. infrastructure failures which first need to be fixed.
* update documentation
there is only one test class making use of it left. This test class is the
GitUtilsTest itself.
Hence moving this member downwards in the test class hierarchy into GitUtilsTest.
I doubt it makes sense to make use of a generic git utils mock somewhere else since this basically
means to test the GitUtils class in the conxtext of other examinees. For that there is no need.
The GitUtils class should be tested by the corresponding test class, but not in a transive manner
by other tests. For all other tests a specific git utils mock should be provided mocking the corresponding
method class. This is already the case today, otherwise we would have more test classes making use
of the generic git utils mock.
When we register a closure as file, the closure will be exectutd.
Otherwise we return what is registered.
This gives us a maximum level of flexibility. We can throw exceptions (e.g. FileNotFound) as
as test setup requires this, in simple cases we provide the yaml as a string.
We can now registering files to JenkinsReadYamlRule by
providing the file name alongside with the expected content
(or e.g. an expception)
With that change it is possible to remove pwd statements
from mtaBuild. These statements was used in order to pass
a temporary directory inside the mtaBuild (code under test).
This is not needed anymore since we can register the files
directly.
Having pwd implies working with absolute pathes which is
also a no-go when working with docker, since the absolute
pathes inside and outside docker are normally not the same.
For pathes relative to a build root directory it is rather
easy to keep the pathes consistent the same.
Adjust sources according to registering yaml file to jenkins rule.
For mtaBuild this means also: get ride of absolute pathes for denoting the yaml file.
Having absolute pathes makes it difficult/impossible to work also with dockerized versions
of mtaBuild since the absolute pathes are most probably not the same inside and outside
the docker container, but the relatives pathes can be kept the same easily.
read yaml rule is a very frequently used rule. But having the rule in the common rules
means we cannot register text or files to that rule, which makes it less handy to work
with yaml files in the tests.
* Create executeDockerOnKubernetes.groovy
* Update dockerExecute.groovy
* Create SysEnvTest.groovy
* Update default_pipeline_environment.yml
* Update executeDockerOnKubernetes.groovy
* Create utils object
* update docker image
* Update mavenExecute.groovy
* Use pipeline-lib than piper
* Check container name
* Always change ownership to 1000
* Check for map
* Fix command
* Move chmod to docker execute
* Use generic name for the pod
* runAsPod has been added
* Return false if script has no k8smapping
* fix syntax error
* Null checks
* Returnn dockerImage name
* Check method body
* Return container name
* Cleanup echos
* Use runAsPod
* Rename step
* Use official jenkins JNLP agent image
* Construct containersMap
* Check if kubernetes plugin is active
* Support JaaS
* pass script object
* Move configuration to default section
* Use generic flag to check if running in k8s
* fix jnlp agent name
* Solve travis errors
* Improvements to config and changes to name of the method
* Improvements to config
* Fix type
* Rename stash config
* add import
* Fix map order
* Fix jnlp agent name
* cleanup config usage
* Check if config is enabled
* Use nested k8s mapping
* Support custom docker workspace and move flag to env
* Feature/k8s stage (#1)
* Use nested k8s mapping
* Support custom docker workspace and move flag to env
* Check dockerOptions value
* Support local execution
* Add tests for dockerExecute
* Move config to step and Fix tests
* Use step configuration while running as a pod
* Streamline parameter and config initialization
* Streamline parameter and tests
* Cleanup and align variable name
* Use default JNLP agent if one not defined in config
* Add tests for runInsidePod. Ensure lowercase container names.
* Improve tests and remove unused code block
* Fix permission issues
* Perform stashing and unstashing inside container
* Use custom jnlp agent due to user id restriction
* Fix tests after jnlp agent change
* Address review comments
* Initialize script to default value if null
* Address review comments
* Update exeception handling and documentation
* Improve documentation
* correct indent
* Link documents to the index page
* Merge containerExecute and dockerExecuteOnKuberenetes step and address comments.
* Update dockerExecute.md
* Update dockerExecuteOnKubernetes.md
* Update default_pipeline_environment.yml
* update documentation
* Update documentation. Use annotation for singleton
* Update DockerExecuteOnKubernetesTest.groovy
* Update dockerExecute.groovy
* Update dockerExecuteOnKubernetes.groovy
* Improve documentation and test case names
* neoDeploy: switch to chained ConfigurationHelper (#244)
* switch neoDeploy to chained ConfigurationHelper
* update imports
* Improve tests
* Address review comments
* Improve documentation
* made dockerImage non-mandatory parm, improved test
* add comment regarding userid assumption
Instead of configuring the credentials setup
o withCredentials
o usename
in each of our tests (for the moment change-management related)
we collect the common coding in a JUnitRule.
With the current approach of checking log entries we are not able to
check log entries in case of a failure. But is is important to assert
log messages in case of a failure. Having reasonable log messages
simplified troubleshooting.
Hence we add JenkinsLoggingRule.expect(substring) and check after the
base of that rule has been called.
This interfears with other rules also working with an expect approach,
like e.g. ExpectedException. Which violation is presented depends on
the order or the rules around the test case.
Comparism on plain string level gets complicated for complex commands and means
an implict check for an exact version of a command line. There are cases where
such an exact check is not desired, e.g. there is nothing wrong with having the
order of arguments variable.