janjoerke / vscode-jenkins-pipeline-linter-connector

MIT License
60 stars 21 forks source link

Runtime validation. #7

Closed shashikumaarb closed 5 years ago

shashikumaarb commented 5 years ago

Hi how do I debug the jenkins.groovy file. this extension is basically validating that if the file is syntactically correct or not but does not catch run time exception.

e.g. this script is valid but when I run this in jenkins it errors because the csproj isn't right xml doc.

!groovy

def WORKSPACE = env.WORKSPACE def VERSION = "1.5.0" //maintain version here

node('Windows') { //this instructs Jenkins to use the agent with label 'Windows' (exact spelling)

    def checkoutscm = checkout scm  //clone the repository
    echo "SCM checkout: ${checkoutscm}"
    echo "VERSION before is ${VERSION}"
    def files = bat(script: "dir core", returnStdout: true)
    echo "Files: ${files}"
    def csprojFile = readFile("${env.WORKSPACE}/Core/Core.csproj");
    echo "csprojFile: ${csprojFile}"
    def xml = new XmlSlurper().parse(csprojFile)        
    /*VERSION = xml.PropertyGroup.Version.text()*/
    echo "VERSION after is ${VERSION}"
    def NUGET_PATH = env.NUGET_PATH
    echo "SEMVER is: ${SEMVER}"

}
error: java.net.MalformedURLException: no protocol:

netcoreapp2.0 Aim.Cohesion.Core Aim.Cohesion.Core 1.1.3 true

at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
janjoerke commented 5 years ago

Hi, this extension does not validate the groovy script on its own. It´s only purpose is to send the Jenkinsfile from within VS Code to the Jenkins server, so that you don´t have to send it by yourself. The validation takes place on the Jenkins server.