diff options
author | RHE <rebirthmonkey@gmail.com> | 2018-01-17 14:35:01 +0100 |
---|---|---|
committer | RHE <rebirthmonkey@gmail.com> | 2018-01-17 14:35:01 +0100 |
commit | e475b83c1f711e77814d68f933ff2d661102806a (patch) | |
tree | 76a710b94a3c16a6b8dd55c84070683ac3008828 | |
parent | 920c9eb45f976b264b3d66c5e6cef80b1354a825 (diff) |
jenkins conf
Change-Id: Ide859a78b8b4f05008106d9aca8f84eaeb0f538b
Signed-off-by: RHE <rebirthmonkey@gmail.com>
-rw-r--r-- | Jenkinsfile | 23 | ||||
-rw-r--r-- | tools/moon_jenkins/Dockerfile | 1 | ||||
-rw-r--r-- | tools/moon_jenkins/Jenkinsfile | 24 | ||||
-rw-r--r-- | tools/moon_jenkins/docker-compose.yml | 6 | ||||
-rw-r--r-- | tools/moon_jenkins/plugins.txt | 2 | ||||
-rw-r--r-- | tools/moon_jenkins/setenv.groovy | 34 |
6 files changed, 26 insertions, 64 deletions
diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..42756ece --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,23 @@ +properties([ + pipelineTriggers([cron('H * * * *')]) +]) +node { + checkout scm + def packages = ["python_moonutilities","python_moondb","python_moonclient"] + def subtests = [:] + for (x in packages) { + def pkg = x + subtests[pkg] = { + withDockerContainer('wukongsun/moon_python_unit_test') { + stage("Install prerequisites for package ${pkg}") { + sh("pip install pytest requests_mock requests --upgrade") + sh("cd ${pkg} && pip install -r tests/unit_python/requirements.txt && pip install .") + } + stage("Unit test for package ${pkg}") { + sh "cd ${pkg}/tests/unit_python && pytest ." + } + } + } + } + parallel subtests +}
\ No newline at end of file diff --git a/tools/moon_jenkins/Dockerfile b/tools/moon_jenkins/Dockerfile index 573d4ac8..058f388c 100644 --- a/tools/moon_jenkins/Dockerfile +++ b/tools/moon_jenkins/Dockerfile @@ -3,7 +3,6 @@ FROM jenkinsci/blueocean ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false" COPY security.groovy /usr/share/jenkins/ref/init.groovy.d/security.groovy -COPY setenv.groovy /usr/share/jenkins/ref/init.groovy.d/setenv.groovy COPY plugins.txt /usr/share/jenkins/ref/plugins.txt RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
\ No newline at end of file diff --git a/tools/moon_jenkins/Jenkinsfile b/tools/moon_jenkins/Jenkinsfile deleted file mode 100644 index 7e0e07c0..00000000 --- a/tools/moon_jenkins/Jenkinsfile +++ /dev/null @@ -1,24 +0,0 @@ -pipeline { - agent { - docker { - image 'wukongsun/moon_python_unit_test' - args '-e moon_home=${moon_home}' - } - } - stages { - stage('Python Unit Test') { - steps { - script { - sh("cd ${moon_home}/tests/python_unit") - sh("bash run_tests") - } - } - } - stage('Functional Test') { - script { - sh("cd ${moon_home}/tests/functional") - sh("bash run_tests") - } - } - } -}
\ No newline at end of file diff --git a/tools/moon_jenkins/docker-compose.yml b/tools/moon_jenkins/docker-compose.yml index 2329f7bd..eb9354ce 100644 --- a/tools/moon_jenkins/docker-compose.yml +++ b/tools/moon_jenkins/docker-compose.yml @@ -1,12 +1,10 @@ version: '3.1' services: - jenkins: build: context: . - args: - image: blueocean:v0.3 + image: blueocean:v0.4 ports: - 8080:8080 - 50000:50000 @@ -19,4 +17,4 @@ services: user: root volumes: - jenkins-data: + jenkins-data:
\ No newline at end of file diff --git a/tools/moon_jenkins/plugins.txt b/tools/moon_jenkins/plugins.txt index 2463d029..65bae872 100644 --- a/tools/moon_jenkins/plugins.txt +++ b/tools/moon_jenkins/plugins.txt @@ -97,4 +97,4 @@ ssh-slaves pam-auth ldap email-ext -locale +locale
\ No newline at end of file diff --git a/tools/moon_jenkins/setenv.groovy b/tools/moon_jenkins/setenv.groovy deleted file mode 100644 index ab2dc137..00000000 --- a/tools/moon_jenkins/setenv.groovy +++ /dev/null @@ -1,34 +0,0 @@ -#!groovy - -import jenkins.* -import jenkins.model.* -import hudson.* -import hudson.model.* - -instance = Jenkins.getInstance() -globalNodeProperties = instance.getGlobalNodeProperties() - -envVarsNodePropertyList = globalNodeProperties.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) - -newEnvVarsNodeProperty = null -envVars = null - -if (envVarsNodePropertyList == null || envVarsNodePropertyList.size() == 0) { - newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty(); - globalNodeProperties.add(newEnvVarsNodeProperty) - envVars = newEnvVarsNodeProperty.getEnvVars() -} else { - envVars = envVarsNodePropertyList.get(0).getEnvVars() -} - -http_proxy = System.getenv()['http_proxy'] -https_proxy = System.getenv()['https_proxy'] - -if (http_proxy) { - envVars.put("http_proxy", System.getenv()['http_proxy']) -} -if (https_proxy) { - envVars.put("https_proxy", System.getenv()['https_proxy']) -} - -instance.save() |