Jenkins automatic push on external repository after pipeline complete

2018-05-02 Thread Francesco Sisca
Hello everyone. I have a question for you.

At the moment, I and my team works on a staging repository. Every project 
have a Jenkins Job with declarative Pipeline. Our target is:

When pipeline complete correctly all steps, it can push on production 
repository all code?

i'm try with a simple step (on example repository):

this is Jenkinsfile on Staging repository (testSubTree it's staging name).

pipeline {
agent any

stages {
stage('push on master prod'){
steps{
sh 'git push prod'
}
}
}
}

when

[centos@cula03up TestAutocommitJenkins]$ sudo git remote -v
origin  /HO_staging/testSubTree.git (fetch)
origin  /HO_staging/testSubTree.git (push)
prod/HO_production/testSubTree.git (fetch)
prod/HO_production/testSubTree.git (push)


but doesn't work... and I don't get any errors, simply my production 
repository isn't update

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6945f3c5-c281-48ae-a10b-bae16e1d618e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using Gradle in Pipeline

2018-04-13 Thread Francesco Sisca




check configuration of gradle in your global configuration tools (into 
jenkins manage) 




this is my pipeline:


pipeline {

agent any
tools {
gradle "gradle"
}
environment{
ANDROID_HOME="/opt/sdk-tools-linux-3859397"

PATH="${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools"
}





Il giorno venerdì 13 aprile 2018 08:02:43 UTC+2, Sverre Moe ha scritto:
>
> We are currently using Maven for building our applications. 
>
> Our Jenkins maven pipeline are using the withMaven step from Pipeline 
> Maven Integration.
>
> I have written gradle build scripts for our projects and begun to write 
> the Pipeline build script to build gradle.
>
> We could really use an Pipeline Gradle Integration plugin and an 
> withGradle step.
>
> In the absence of such a plugin I am left with
> tool name: 'gradle-4.6', type: 'gradle'
> sh "gradle build"
>
> I think I have to put some verbosity to gradle. The Jenkins console output 
> did not provide any insight while gradle was running the JUnit tests.
>
> :processResources
> :classes
> :jar
> :javadoc
> :javadocJar
> :sourcesJar
> :assemble
> :startMockServer
>
> :processTestResources
> :testClasses
> :test
>
> :stopMockServer
> :check
> :build
>
>
> After :test there was no output for about 2 minutes. Not until task test was 
> finished.
>
> Not knowing if the build has halted, a test taking to long, or some other 
> problem.
>
>
> Would be great to have something like the dynamic output from running gradle
>
> <=> 75% EXECUTING [15s]
>
> > :test > 100 tests completed
>
> > :test > Executing test com.company.api.ConnectionTest
>
>
>
> Running Gradle with --console=rich gives me this output, but it is a mess.
>
> :test [m [0K [7D [1B [2A [1m< [0;32;1m= [0;39;1m> 75% 
> EXECUTING [9s] [m [34D [1B [1m> :test [m [7D [1B [2A [1m< [0;32;1m= 
> [0;39;1m> 75% EXECUTING [9s] [m [34D [1B [1m> :test > 0 tests completed 
> [m [27D [1B [2A [1m< [0;32;1m= [0;39;1m> 75% EXECUTING [9s] [m 
> [34D [1B [1m> :test > 0 tests completed [m [27D [1B [2A [1m< 
> [0;32;1m= [0;39;1m> 75% EXECUTING [9s] [m [34D [1B [1m> :test > 
> 0 tests completed [m [27D [1B [2A [1m< [0;32;1m= [0;39;1m> 75% 
> EXECUTING [9s] [m [34D [1B [1m> :test > 0 tests completed [m [27D [1B [2A 
> [1m< [0;32;1m= [0;39;1m> 75% EXECUTING [9s] [m [34D [1B [1m> 
> :test > 0 tests 
> ...
> ...
> > 330 tests completed [m [29D [1B [1m> :test > Executing test 
> com.company.server.api.commands.Command1Test [m [0K [68D [1B [3A [1m< 
> [0;32;1m= [0;39;1m> 75% EXECUTING [1m 29s] [m [38D [1B [1m> 
> :test > 412 tests completed [m [29D [1B [1m> :test > Executing test 
> com.company.server.api.commands.Command2Test [m [76D [1B [3A [1m< 
> [0;32;1m= [0;39;1m> 75% EXECUTING [1m 29s] [m [38D [1B [1m> 
> :test > 507 tests completed [m [29D [1B [1m> :test > Executing test 
> com.company.server.api.commands.Command3Test [m [0K [68D [1B [3A [1m< 
> [0;32;1m= [0;39;1m> 75% EXECUTING [1m 29s] [m [38D [1B [1m> 
> :test > 661 tests completed [m [29D [1B> IDLE [0K [6D [1B [3A [1m< 
> [0;32;1m= [0;39;1m> 75% EXECUTING [1m 29s] [m [38D [1B [1m> 
> :test > 661 tests completed [m [29D [2B [3A [1m< [0;32;1m= 
> [0;39;1m> 75% EXECUTING [1m 29s] [m [38D [1B [1m> :test > 661 tests 
> completed [m [29D [2B [3A [1m< [0;32;1m= [0;39;1m> 75% 
> EXECUTING [1m 30s] [m [38D [1B [1m> :test > 661 tests completed [m [29D [2B 
> [3A [1m< [0;32;1m= [0;39;1m> 75% EXECUTING [1m 30s] [m [38D [1B 
> [1m> :test [m [0K [7D [2B [3A [1m< [0;32;1m= [0;39;1m> 75% 
> EXECUTING [1m 30s] [m [38D [1B [1m> :test [m [7D [2B [3A [0K
> [0K
> [32;1mBUILD SUCCESSFUL [0;39m in 1m 32s
> 11 actionable tasks: 11 executed
>
>
>
> Are anyone using gradle in their Jenkins pipeline?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/efa58033-672a-4803-b56d-4fe5acf5a064%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Publish on HockeyApp application with declarative pipeline - How integrate Android tools

2018-04-06 Thread Francesco Sisca
Hello everyone, i have a trouble.

i need, after build, to publish my application on Hockeyapp. I'm trying to 
do this, but get an error. this is my pipeline

pipeline {
agent any
tools {
gradle "gradle"
}

stages {
stage('Check Env Works'){
steps {
nodejs(nodeJSInstallationName: 'nodejs') {
sh 'env'
sh 'npm -v'
sh 'gulp -v'
sh 'cordova -v'
sh 'java -version'
sh 'node -v'
sh 'tslint -v'
sh 'ionic info'
sh 'gradle -v'

}
}
}
stage('Download dependency from Nexus'){
steps {
nodejs(nodeJSInstallationName: 'nodejs') {
sh 'npm config get registry'
sh 'npm whoami'
sh 'npm i'
}
}
}
stage('Build APK file'){
steps {
nodejs(nodeJSInstallationName: 'nodejs') {
sh 'ionic cordova build android'
}
}
}
stage('Upload APK to HockeyApp'){
steps {
sh 'curl \
  -F "status=2" \
  -F "notify=1" \
  -F "notes=Some new features and fixed bugs." \
  -F "notes_type=0" \
  -F "apk=@hockeyapp.apk" \
  -H "X-HockeyAppToken: XX" \
  
https://rink.hockeyapp.net/api/2/apps/XXX/0.0.0.0.5/upload'
}
}
}

post {
 always { 
 mail bcc: '', body: "Example\nProject: 
${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER}  URL de build: 
${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 
'text/html', replyTo: '', subject: "Always CI: Project name -> 
${env.JOB_NAME}", to: "x";  
 }  
 success {  
 mail bcc: '', body: "Example\nProject: 
${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER}  URL de build: 
${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 
'text/html', replyTo: '', subject: "Success CI: Project name -> 
${env.JOB_NAME}", to: "x";  
 }  
 failure {  
 mail bcc: '', body: "Example\nProject: 
${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER}  URL de build: 
${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 
'text/html', replyTo: '', subject: "Failur CI: Project name -> 
${env.JOB_NAME}", to: "x";  
 }  
 unstable {  
 mail bcc: '', body: "Example\nProject: 
${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER}  URL de build: 
${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 
'text/html', replyTo: '', subject: "Unstable CI: Project name -> 
${env.JOB_NAME}", to: "x";  
 }  
 changed { 
 mail bcc: '', body: "Example\nProject: 
${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER}  URL de build: 
${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 
'text/html', replyTo: '', subject: "Changed CI: Project name -> 
${env.JOB_NAME}", to: "x";  
 }  
}
}

but when i ran this, i get this error

(node:1183) UnhandledPromiseRejectionWarning: Unhandled promise rejection 
(rejection id: 1): Error: 
/opt/jenkins/work/workspace/PipelineMobileHubReferenceApplication/platforms/android/gradlew:
 
Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script 
'/opt/jenkins/work/workspace/PipelineMobileHubReferenceApplication/platforms/android/CordovaLib/cordova.gradle'
 
line: 68

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> No installed build tools found. Install the Android build tools version 
19.1.0 or higher.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s




how i solve this? Here the complete log

Started by user admin
Obtained Jenkinsfile from git 
https:///mobilehub-reference-application.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in 
/opt/jenkins/work/workspace/PipelineMobileHubReferenceApplication
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url 
https://l/mobilehub-reference-application.git # timeout=10
Fetching upstream changes from 
https://ll/mobilehub-reference-application.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress 
https://lll/l/mobilehub-reference-application.git 
+refs/heads/*:refs/remotes/origin/*
 > git rev-parse 

Re: Ionic command doesn't works for jenkins job

2018-01-08 Thread Francesco Sisca
ok thanks for the advice

Il giorno lunedì 8 gennaio 2018 20:11:57 UTC+1, Victor Martinez ha scritto:
>
> It looks like this is not an issue within Jenkins itself but the agent 
> configuration. I'm afraid you need to install all the specific requirements 
> in the agent and I'm not sure if those env variables refers to the same 
> machine or two different ones.
> Therefore, whoever owns that particular agent might help you to set it up 
> accordingly, just in case they use any kind of configuration management 
> tool. In case you need to bypass the above, you can append to the PATH env 
> variable with the path to that particular ionic binary before running any 
> shell stuff
>
>
> Something like :
>
> PATH=$PATH:
> 
>
> My two cents
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/dbb26491-7c07-4191-887d-ecdef8d0679e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ionic command doesn't works for jenkins job

2018-01-08 Thread Francesco Sisca



Thanks for the answer!

this is  ENV PATH for the owner (masdev).



Mac-mini-di-masdev:mobilehub-reference-application masdev$ echo $PATH

/Users/masdev/.rvm/gems/ruby-2.4.2/bin:/Users/masdev/.rvm/gems/ruby-2.4.2@global/bin:/Users/masdev/.rvm/rubies/ruby-2.4.2/bin:~/.npm-global/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/masdev/Library/Android/sdk/tools:/Users/masdev/Library/Android/sdk/platform-tools:/Users/masdev/Downloads/apache-maven-3.5.2/bin:/Users/masdev/.rvm/bin

while ENV PATH on the jenkins user (Jenkins) is this  




how i fix this?


Il giorno lunedì 8 gennaio 2018 17:36:51 UTC+1, Victor Martinez ha scritto:
>
> It sounds a kind of environmental issue with the PATH env variable. You 
> can confirm how that particular PATH env variable looks like in your local 
> and also within Jenkins, then you can set it accordingly,.
>
> Cheers
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/819bdaaf-501f-4195-badb-6cc0f827cb72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ionic command doesn't works for jenkins job

2018-01-08 Thread Francesco Sisca
Hello everyone, i'm in trouble about some jenkins stuff.

I have a hybrid application, and i need to setup automatic build for that. 
i follow those steps to build the app.

npm i
ionic cordova platform add android --no-interactive
ionic cordova build android --prod --no-interactive

and that's works fine. But when i put this commands into a build.sh file, 
and put this file into Jenkins "shell command", when i run "build" into 
jenkins, i get an error "ionic: command not found".

I'm working on MacOS, and Jenkins have a separate User. Of Course, from 
CLI, all works fine.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/056ae4f1-8b84-48a2-878d-62f360f97580%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Build and publish hybrid application mobile

2017-12-20 Thread Francesco Sisca
Hello everyone. For my company i build a hybrid app (angular2 and ionic2) 
and deploy it both Android and iOS. Actually i do it manually with this 
command 

ionic cordova platform add ios
ionic cordova platform add android
ionic cordova build ios --prod
ionic cordova build android --prod

and after this I sign the ios application with xcode to create ipa and 
publish it. Now, i can automatize this with jenkins? How?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e70cacdc-9418-4431-8925-fb64f6bcdc99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.