|
1 |
| -h3. Migration to Codeship |
| 1 | +## Migration to Codeship |
2 | 2 |
|
3 |
| -It is a temporal file to track the migration steps od moving this project from Jenkins D@C to Codeship Basic project |
| 3 | +It is a temporal file to track the migration steps of moving this project from Jenkins D@C to Codeship Basic project |
4 | 4 |
|
5 |
| -h4. Carlos (16/08/2018) |
| 5 | +**Notes**: |
6 | 6 |
|
| 7 | +* Codeship currently does’t trigger builds for PRs from forked repositories. We have created a RFE for that [PROD-1600](https://cloudbees.atlassian.net/browse/PROD-1600) |
7 | 8 | * Sonar configuration needs to be move from the `Manage Jenkins > Configure system` to `Codeship Basic > Enviroment Section`
|
8 | 9 | * Maven options has been moved to Setup Commands `export MAVEN_OPTS="-Xmx512m -Djava.awt.headless=true"`
|
9 | 10 | * Sonar configuration is passed by parameters: https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
|
10 | 11 | * Replacing Jenkins `env.BRANCH_NAME` for Codeship `CI_BRANCH`
|
11 |
| -* Pushing a first commit to your repository to trigger your first build in Codeship |
| 12 | +* Pushing a first commit to your repository to trigger your first build in Codeship |
| 13 | +* All groovy needs to be converted into shell format |
| 14 | +* Shell format multiline is not supported |
| 15 | +* To check line 13 `_ bash: [: too many arguments` |
| 16 | +* BUILD SUCCESS but with mvn `verify` goal default |
| 17 | + |
| 18 | +### Setup Commands |
| 19 | + |
| 20 | +``` |
| 21 | +# We currently support OpenJDK 7, as well as Oracle JDK 7 & 8. |
| 22 | +jdk_switcher use oraclejdk8 |
| 23 | +# Maven |
| 24 | +export MAVEN_OPTS="-Xmx512m -Djava.awt.headless=true" |
| 25 | +``` |
| 26 | + |
| 27 | +### Pipeline |
| 28 | + |
| 29 | +``` |
| 30 | +export pom_version=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml) |
| 31 | +export isSnapshot=false |
| 32 | +export deployOrVerity='verify' |
| 33 | +if [ "$pom_version" =~ "-SNAPSHOT" ]; then isSnapshot=true; fi |
| 34 | +if [ [ "$CI_BRANCH" = "master" ] && [ isSnapshot ] ]; then deployOrVerity='deploy -DdeployAtEnd=true'; fi |
| 35 | +## DEBUG |
| 36 | +echo "Running: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent ${deployOrVerity} sonar:sonar -Dsonar.organization=cloudbees -Dsonar.branch.name=${CI_BRANCH} -Dsonar.host.url=${SONAR_URL} -Dsonar.login=${SONAR_TOKEN} -Dmaven.test.failure.ignore=true" |
| 37 | +## END DEBUG |
| 38 | +mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent ${deployOrVerity} sonar:sonar -Dsonar.organization=cloudbees -Dsonar.branch.name=${CI_BRANCH} -Dsonar.host.url=${SONAR_URL} -Dsonar.login=${SONAR_TOKEN} -Dmaven.test.failure.ignore=true |
| 39 | +``` |
| 40 | + |
| 41 | +### Enviroment Variables: |
| 42 | + |
| 43 | +* `SONAR_URL` |
| 44 | +* `SONAR_TOKEN` |
0 commit comments