-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added kamaji-api without cloud bits.
- Loading branch information
jonatan treijs
committed
Feb 9, 2018
1 parent
e8670ca
commit 5006dda
Showing
158 changed files
with
17,716 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio | ||
|
||
*.iml | ||
|
||
## Directory-based project format: | ||
.idea/ | ||
# if you remove the above rule, at least ignore the following: | ||
|
||
# User-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# .idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
# .idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
# .idea/gradle.xml | ||
# .idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
# .idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.ipr | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
/out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
doc/build_remote | ||
|
||
# PyBuilder | ||
target/ | ||
### VirtualEnv template | ||
# Virtualenv | ||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ | ||
.Python | ||
[Bb]in | ||
[Ii]nclude | ||
[Ll]ib | ||
[Ss]cripts | ||
pyvenv.cfg | ||
pip-selfcheck.json | ||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
|
||
# Mac OS X specific | ||
.DS_Store | ||
|
||
# SQlite file | ||
db.sqlite3 | ||
results.sqlite | ||
|
||
# Vagrant | ||
.vagrant | ||
|
||
# redis dumps | ||
dump.rdb | ||
|
||
# visual studio code | ||
.vscode | ||
|
||
# The private keys (since they are now regenerated once in a while) | ||
kamajiapi/provisioning/ansible/keys/private.key | ||
kamajiapi/shared/ansible/keys/private.key | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env groovy | ||
|
||
import groovy.json.JsonOutput | ||
|
||
/* Reference the GitLab connection name */ | ||
properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'gitlab']]) | ||
|
||
node() { | ||
try { | ||
/* Notify that the job is starting */ | ||
notifyBuild('STARTED') | ||
|
||
stage ('Clean workspace') { | ||
/* Clean up workspace before bulding */ | ||
deleteDir() | ||
} | ||
|
||
stage ('Checkout source') { | ||
/* Represents the SCM configuration in a "Workflow from SCM" project build. */ | ||
checkout scm | ||
} | ||
|
||
gitlabCommitStatus { | ||
stage ('Install requirements') { | ||
/* Set up a virtual environment for python and install requirements from file. */ | ||
sh 'virtualenv venv' | ||
sh 'venv/bin/pip install --upgrade pip' | ||
sh 'venv/bin/pip install -r requirements-tests.txt' | ||
} | ||
|
||
stage ('Run tests') { | ||
withEnv(['DJANGO_SETTINGS_MODULE=api.settings.tests']) { | ||
/* Run unit test. */ | ||
sh 'venv/bin/python kamajiapi/manage.py jenkins --enable-coverage' | ||
} | ||
} | ||
} | ||
|
||
stage ('Archive artifacts') { | ||
/* Get short git commit and save build info into a json file */ | ||
GIT_SHORT = sh( | ||
script: "git rev-parse --short HEAD", | ||
returnStdout: true | ||
).trim() | ||
|
||
CURRENT_TIMESTAMP = sh( | ||
script: "date +%s", | ||
returnStdout: true | ||
).trim() | ||
|
||
BUILD_INFO = JsonOutput.toJson( | ||
"git_short": GIT_SHORT, | ||
"build_timestamp": CURRENT_TIMESTAMP, | ||
"build_node": env.NODE_NAME, | ||
"build_id": env.BUILD_ID, | ||
"build_name": env.JOB_NAME | ||
) | ||
|
||
sh "echo '${BUILD_INFO}' | jq . > kamajiapi/build.json" | ||
|
||
/* Archive artifacts if the build is successful. */ | ||
archiveArtifacts artifacts: 'kamajiapi/**,requirements*.txt', onlyIfSuccessful: true | ||
} | ||
|
||
} catch (exc) { | ||
/* Catch exceptions - build failed */ | ||
currentBuild.result = "FAILED" | ||
throw exc | ||
} finally { | ||
/* Always send a notify */ | ||
notifyBuild(currentBuild.result) | ||
} | ||
} | ||
|
||
def notifyBuild(String buildStatus = 'STARTED') { | ||
/* Build status of null means successful */ | ||
buildStatus = buildStatus ?: 'SUCCESSFUL' | ||
|
||
def message = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})'" | ||
|
||
/* Override default values based on build status */ | ||
if (buildStatus == 'STARTED') { | ||
color = 'warning' | ||
} else if (buildStatus == 'SUCCESSFUL') { | ||
color = 'good' | ||
} else { | ||
color = 'danger' | ||
} | ||
|
||
/* Send notification */ | ||
slackSend (color: color, message: message) | ||
} |
Oops, something went wrong.