Last active
March 20, 2017 15:15
-
-
Save jincod/0d3ed1a70c1f9260a19bba9493fa57ae to your computer and use it in GitHub Desktop.
Dotfiles
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
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
trim_trailing_whitespace = true | |
[*.js] | |
indent_style = tab | |
indent_size = 2 | |
insert_final_newline = true | |
[*.cs] | |
indent_style = tab | |
indent_size = 4 | |
# Xml project files | |
[*.csproj] | |
indent_size = 2 | |
# JSON files | |
[*.json] | |
indent_style = space | |
indent_size = 2 |
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
node('label || slave-name') { | |
def repoUrl = 'ssh://repo-url' | |
def channelName = '#dev-channel-name' | |
def buildTimestamp = new Date().format('yyyyMMddHHmmss') | |
def repoDirectory | |
try { | |
milestone label: 'Starting th job', ordinal: 100 | |
stage ('prepare') { | |
dir('repo') { | |
repoDirectory = pwd() | |
git changelog: false, branch: BRANCH_NAME, poll: false, url: repoUrl | |
} | |
} | |
milestone label: 'Starting the build', ordinal: 200 | |
stage ('build') { | |
dir('repo') { | |
// call build project script. Sample: | |
bat 'build.cmd' | |
} | |
} | |
stage ('unit tests') { | |
dir('repo') { | |
try { | |
// For xUnit tests | |
bat 'packages\\xunit.runner.console.2.1.0\\tools\\xunit.console.exe .\\Tests\\UnitTests\\bin\\UnitTests.dll -nunit test-reports\\BackendTests.xml -nologo' | |
} | |
catch (Exception e) { | |
throw new Exception('Some tests has been failed for the project') | |
} | |
finally { | |
junit 'test-reports\\*.xml' | |
} | |
} | |
} | |
stage('SonarQube analysis') { | |
dir('repo') { | |
def scannerHome = tool 'SonarQube Scanner 2.8'; | |
withSonarQubeEnv('SonarQube Server') { | |
bat "${scannerHome}\\bin\\sonar-scanner -Dsonar.login=${SONAR_AUTH_TOKEN} -Dsonar.projectVersion=1.${BUILD_NUMBER}" | |
} | |
} | |
} | |
if (env.BRANCH_NAME == "master" || env.BRANCH_NAME == "develop") { | |
milestone label: 'Starting the publishing', ordinal: 300 | |
stage ('publish') { | |
dir('artifacts') { | |
// some actions | |
slackSend channel: channelName, message: "Artifacts published: $env.JOB_NAME - $BRANCH_NAME $env.BUILD_NUMBER" | |
} | |
} | |
} | |
} | |
catch (Exception e) { | |
slackSend color: 'danger', channel: channelName, message: "Error during build $env.JOB_NAME - $BRANCH_NAME $env.BUILD_NUMBER: $e.message" | |
throw e | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://issues.jenkins-ci.org/browse/JENKINS-35230
GIT_URL is null