Re: Pipeline DSL, IntelliJ, and maven

2017-03-03 Thread Justin Knowles
Cool, that worked, thanks Daniel. Last question (I think) - is there a way
to have autocompletion work in other existing projects without them being a
Groovy project or having that DSL file in the codebase?

Thanks again for your help.

On Fri, Mar 3, 2017 at 2:15 AM, Indra Gunawan (ingunawa) <ingun...@cisco.com
> wrote:

> Somehow is there other IDE that can be supported.  Can Jenkinsfile syntax
> hightlighting be supported in SublimeText and recently Visual Studio Code.
>
> Thank you
>
>
> On 3/2/17, 4:01 PM, "jenkinsci-users@googlegroups.com on behalf of Daniel
> Beck" <jenkinsci-users@googlegroups.com on behalf of m...@beckweb.net>
> wrote:
>
>
> > On 03.03.2017, at 00:12, Justin Knowles <jaycee...@gmail.com> wrote:
> >
> > are there even install instructions on that page or directions for
> how to get IntelliJ to understand GroovyDSL/Jenkinsfile?
>
> It works for me with IntelliJ 2016.3.4.
>
> Steps:
>
> 1. Create a new Java project with Groovy dependency.
> 2. Right-click 'src', New, Groovy Script, call it 'dsl' and select
> kind 'GroovyDSL script'.
> 3. Paste in the output from Jenkins and save.
> 4. 'Activate back'
> 5. Right-click 'src', New, Groovy Script, call it 'Jenkinsfile' and
> select kind 'Groovy script'.
> 6. Paste in your Jenkinsfile
> 7. Enjoy autocompletion etc.
>
> --
> 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/20131B21-731E-4614-A2DF-A44BF686FC16%40beckweb.net.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/S0_etu_70oY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/AF6EC515-5430-4446-B1EC-2C4C32DB4F03%40cisco.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFZDVTh6cw1H7GFNnqVQbXA3N-%2B0JwmPhkctYH3dsuz8bhXxyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pipeline DSL, IntelliJ, and maven

2017-03-02 Thread Justin Knowles
Not trying to be obtuse, but are there even install instructions on that
page or directions for how to get IntelliJ to understand
GroovyDSL/Jenkinsfile? I see the "Describing GroovyDSL internal language in
its own terms" section mentioning IDEA PSI but I have no idea where it is
or how to set it up? Am I looking at the right section? This is for an
existing project, FWIW.

On Thu, Mar 2, 2017 at 5:19 PM, Daniel Beck <m...@beckweb.net> wrote:

>
> > On 02.03.2017, at 22:49, Justin Knowles <jaycee...@gmail.com> wrote:
> >
> > I've done that but I'm not seeing any syntax highlighting or
> autocompletion in my Jenkinsfile. I'm not developing a plugin for Jenkins
> or anything, I just want IntelliJ to recognize the Jenkinsfile and provide
> highlighting, style fixes, etc.
>
> The instructions on https://confluence.jetbrains.
> com/display/GRVY/Scripting+IDE+for+DSL+awareness don't work? (Instead of
> writing the GDSL from scratch, just paste the provided one in.)
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/S0_etu_70oY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/BCF97543-D247-45A2-95CC-5B0181E76D30%40beckweb.net.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFZDVTj8XW%3DAHfN%3D4B22wonO6KD-YYVdjEzxhFCc4_ShRxhzxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pipeline DSL, IntelliJ, and maven

2017-03-02 Thread Justin Knowles
Is there a guide on what I do with that GDSL? If I'm understanding
correctly the instructions here (
https://st-g.de/2016/08/jenkins-pipeline-autocompletion-in-intellij) say:
1. take the raw GDSL from /pipeline-syntax
2. drop it into a file called pipeline.gdsl
3. put it somehwere on the classpath

I've done that but I'm not seeing any syntax highlighting or autocompletion
in my Jenkinsfile. I'm not developing a plugin for Jenkins or anything, I
just want IntelliJ to recognize the Jenkinsfile and provide highlighting,
style fixes, etc.

On Thu, Mar 2, 2017 at 4:25 PM, Daniel Beck <m...@beckweb.net> wrote:

>
> > On 02.03.2017, at 21:34, Justin Knowles <jaycee...@gmail.com> wrote:
> >
> > integrated a plugin with IntelliJ for editing a Jenkinsfile when writing
> Jenkins pipelines
>
> There's a GDSL you can download from /pipeline-syntax that provides
> Pipeline syntax, would that work? If not, could you explain what you're
> asking for?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/jenkinsci-users/S0_etu_70oY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/jenkinsci-users/6EAEF958-C442-4A3B-BA0A-CFAE41050335%40beckweb.net.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFZDVTi4_VtovDeOazb-xCT9X6x50VeumbV-zaaJBERi6M0nrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Pipeline DSL, IntelliJ, and maven

2017-03-02 Thread Justin Knowles
Has anyone integrated a plugin with IntelliJ for editing a Jenkinsfile when 
writing Jenkins pipelines? Where can I find how to do this? I'm not seeing 
any plugins in the plugin repositories or on google, and the closest thing 
I've found to a howto was using Gradle and not maven, so I'm unsure of how 
to take those instructions and apply them to my setup.

-- 
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/6d760923-07dd-40d0-a4b7-458023d77b13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Github Organization and credentials

2017-01-11 Thread Justin Knowles
Well after messing with this for days I magically got it working once I 
posted this. The fix for me was a combination of my github org config and 
my Jenkinsfile. In the github org I went to my org -> configure -> 
repository sources (github organization) -> advanced and changed "checkout 
credentials" from "-same as scan credentials-" to explicitly be the same 
credentials I used for the scan credentials.

My Jenkinsfile was changed to:

*node {*
*  checkout scm*

*stage('Test (verify)') {*
*  withMaven(*
*  maven: 'maven3',*
*  mavenLocalRepo: '.repository') {*
*sh "mvn clean install"*
*  }*
*}*
*}*


On Wednesday, January 11, 2017 at 3:12:23 PM UTC-5, Justin Knowles wrote:
>
> Hello. I'm having an issue creating a Github Organization (GO from now on) 
> and also not quite understanding how credentials (the plugin) fit into all 
> this. I think I understand that credentials via the plugin can be siloed 
> into different groups or folders for access control purposes. I have a few 
> credentials in jenkins/global (ie at the URL /credentials), and another 
> scoped to "Jenkins", of which some of the global ones should have 
> sufficient permissions for the GO plugin, but after creating my new GO 
> they're not listed (the list only shows "-none-") and I'm shown a 
> "Credentials 
> are recommended" message. 
>
> Saving my newly created GO kicks off the folder computation process which 
> does nothing because its trying to use anonymous access, and revisiting its 
> settings page still doesn't show any credentials global or otherwise. Ok, 
> understandable. 
>
> From my GO/settings page I have the option of adding credentials with two 
> options: folder credentials provider (by the name of my new GO) and Jenkins 
> credentials provider (by the name of Jenkins). From here I chose to add 
> credentials using the GO provider by generating a new personal access token 
> in github with these permissions: 
>
> * repo  Full control of private repositories*
> *  repo:status  Access commit status*
> *  repo_deployment  Access deployment status*
> *  public_repo*
>
> * admin:repo_hook  Full control of repository hooks*
> *  write:repo_hook  Write repository hooks*
> *  read:repo_hook  Read repository hooks*
>
> * admin:org_hook  Full control of organization hooks*
>
> Those may be too wide, but whatever, I think they're enough? I select 
> those creds, apply the changes, and start folder computation, and now it 
> sees everything. Awesome. As a test I have just one branch in one repo with 
> a Jenkinsfile and this is it:
>
> *node {*
> *  // git url: 'https://github.com/COMPANY/COMPANY-java-core.git 
> <https://github.com/COMPANY/COMPANY-java-core.git>'*
>
> *  stage('Test (verify)') {*
> *withMaven(*
> *  maven: 'maven3',*
> *  mavenLocalRepo: '.repository') {*
> *sh "mvn clean install"*
> *}*
> *  }*
> *}*
>
> With and without that git url has returned different errors, I can go back 
> and find out what they were if it matters. Regardless, with it how it is 
> now if I go to a detected branch and look at the log for what it tried to 
> do using the Jenkins file, I see this: 
> https://gist.githubusercontent.com/jayceekay/20a9797de5fa76a8b444cefc2cf65674/raw/21b507979df4acff83a5609204505d3e6e4bece2/log
>
> Namely, to clone the repo it does:
>
> Connecting to https://api.github.com using ME/** (COMPANY github 
> organization token)
> Cloning the remote Git repository
> Cloning repository https://github.com/COMPANY/COMPANY-java-core.git
>
>
> But then later I see:
>
> Fetching upstream changes from 
> https://github.com/COMPANY/COMPANY-java-core.git
> using GIT_ASKPASS to set credentials COMPANY github organization token
>  > git fetch --tags --progress 
> https://github.com/COMPANY/COMPANY-java-core.git 
> +refs/heads/*:refs/remotes/origin/*
>  > git config remote.origin1.url 
> https://github.com/COMPANY/COMPANY-java-core.git # timeout=10
> Fetching upstream changes from 
> https://github.com/COMPANY/COMPANY-java-core.git
> using GIT_ASKPASS to set credentials COMPANY github organization token
>  > git fetch --tags --progress 
> https://github.com/COMPANY/COMPANY-java-core.git 
> +refs/pull/*/head:refs/remotes/origin/pr/*
> Checking out Revision some_commit_hash (ME/jenkinsfile-test)
>  > git config core.sparsecheckout # timeout=10
>  > git checkout -f some_commit_hash
>
>
> 1. it seems like its doing the same thing more than once
> 2. rather than default to the credentials I gave it it's defaulting to 
> asking for a password
>
> I've read online that from h

Github Organization and credentials

2017-01-11 Thread Justin Knowles
Hello. I'm having an issue creating a Github Organization (GO from now on) 
and also not quite understanding how credentials (the plugin) fit into all 
this. I think I understand that credentials via the plugin can be siloed 
into different groups or folders for access control purposes. I have a few 
credentials in jenkins/global (ie at the URL /credentials), and another 
scoped to "Jenkins", of which some of the global ones should have 
sufficient permissions for the GO plugin, but after creating my new GO 
they're not listed (the list only shows "-none-") and I'm shown a "Credentials 
are recommended" message. 

Saving my newly created GO kicks off the folder computation process which 
does nothing because its trying to use anonymous access, and revisiting its 
settings page still doesn't show any credentials global or otherwise. Ok, 
understandable. 

>From my GO/settings page I have the option of adding credentials with two 
options: folder credentials provider (by the name of my new GO) and Jenkins 
credentials provider (by the name of Jenkins). From here I chose to add 
credentials using the GO provider by generating a new personal access token 
in github with these permissions: 

* repo  Full control of private repositories*
*  repo:status  Access commit status*
*  repo_deployment  Access deployment status*
*  public_repo*

* admin:repo_hook  Full control of repository hooks*
*  write:repo_hook  Write repository hooks*
*  read:repo_hook  Read repository hooks*

* admin:org_hook  Full control of organization hooks*

Those may be too wide, but whatever, I think they're enough? I select those 
creds, apply the changes, and start folder computation, and now it sees 
everything. Awesome. As a test I have just one branch in one repo with a 
Jenkinsfile and this is it:

*node {*
*  // git url: 'https://github.com/COMPANY/COMPANY-java-core.git'*

*  stage('Test (verify)') {*
*withMaven(*
*  maven: 'maven3',*
*  mavenLocalRepo: '.repository') {*
*sh "mvn clean install"*
*}*
*  }*
*}*

With and without that git url has returned different errors, I can go back 
and find out what they were if it matters. Regardless, with it how it is 
now if I go to a detected branch and look at the log for what it tried to 
do using the Jenkins file, I see 
this: 
https://gist.githubusercontent.com/jayceekay/20a9797de5fa76a8b444cefc2cf65674/raw/21b507979df4acff83a5609204505d3e6e4bece2/log

Namely, to clone the repo it does:

Connecting to https://api.github.com using ME/** (COMPANY github 
organization token)
Cloning the remote Git repository
Cloning repository https://github.com/COMPANY/COMPANY-java-core.git


But then later I see:

Fetching upstream changes from https://github.com/COMPANY/COMPANY-java-core.git
using GIT_ASKPASS to set credentials COMPANY github organization token
 > git fetch --tags --progress https://github.com/COMPANY/COMPANY-java-core.git 
 > +refs/heads/*:refs/remotes/origin/*
 > git config remote.origin1.url 
 > https://github.com/COMPANY/COMPANY-java-core.git # timeout=10
Fetching upstream changes from https://github.com/COMPANY/COMPANY-java-core.git
using GIT_ASKPASS to set credentials COMPANY github organization token
 > git fetch --tags --progress https://github.com/COMPANY/COMPANY-java-core.git 
 > +refs/pull/*/head:refs/remotes/origin/pr/*
Checking out Revision some_commit_hash (ME/jenkinsfile-test)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f some_commit_hash


1. it seems like its doing the same thing more than once
2. rather than default to the credentials I gave it it's defaulting to 
asking for a password

I've read online that from here I can go into individual repositories that 
were found and tweak the Github plugin settings (under advanced) and change 
the checkout credentials to be different from the scan credentials, which I 
can see and change, but cannot actually *save*? 

All suggestions welcome!

-- 
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/668c27ca-517e-4823-9d83-05a37906cb35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.