Проект, над которым я работаю, состоит в том, чтобы автоматизировать webhook с помощью gradle и jenkins.Я использую док-контейнер для Дженкинса.Я продолжаю получать эту ошибку:
Started by user admin
Building in workspace /var/jenkins_home/workspace/train-schedule
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/anuarhage/cicd-pipeline-
train-schedule-jenkins # timeout=10
Fetching upstream changes from https://github.com/anuarhage/cicd-pipeline-
train-schedule-jenkins
> git --version # timeout=10
> git fetch --tags --progress https://github.com/anuarhage/cicd-pipeline-
train-schedule-jenkins +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 638b87c61e0341b96748943ec5583b1f1e0115e1
(refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 638b87c61e0341b96748943ec5583b1f1e0115e1
Commit message: "Update README.md"
> git rev-list --no-walk 638b87c61e0341b96748943ec5583b1f1e0115e1 #
timeout=10
[Gradle] - Launching build.
[train-schedule] $ /var/jenkins_home/workspace/train-schedule/gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
:nodeSetup UP-TO-DATE
:npmSetup FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':npmSetup'.
> A problem occurred starting process 'command
'/var/jenkins_home/workspace/train-schedule/.gradle/nodejs/node-v9.11.1-
linux-x64/bin/node''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
2 actionable tasks: 1 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE
Из ошибки, которую я собрал, это была проблема пути и я добавил несколько путей, используя docker exec -it 'filename' bash.Ни один из них не сработал.
Я добавил следующие пути:
PATH=$PATH:~.:.:/:/usr
Я также попытался добавить файл Docker в несколько разных мест с помощью 'HOME =.'безрезультатно
Это скрипт build.gradle:
plugins {
//inlude the nodeJS plugin to execute nodejs and npm tasks
id "com.moowork.node" version "1.2.0"
}
node {
download = true
version = "9.11.1"
npmVersion = "5.6.0"
}
//declare a build task
task build
//declare a task to create a zip of the app
task zip(type: Zip) {
from ('.') {
include "*"
include "bin/**"
include "data/**"
include "node_modules/**"
include "public/**"
include "routes/**"
include "views/**"
}
destinationDir(file("dist"))
baseName "trainSchedule"
}
//declare task dependencies
build.dependsOn zip
zip.dependsOn npm_build
npm_build.dependsOn npm_test
npm_test.dependsOn npmInstall
Я занимаюсь этим <13 часов и могу с уверенностью сказать, что я так же растерян, как и яв начале, любое руководство очень ценится. </p>
Если понадобится какая-либо дополнительная информация, я с готовностью предоставлю ее.
Спасибо
Я копался в узле gradle-плагин, и это то, что я нашел
class NpmSetupTask
extends DefaultTask
{
public final static String NAME = 'npmSetup'
private NpmExecRunner runner
private NodeExtension config
protected List<?> args = []
private ExecResult result
NpmSetupTask()
{
dependsOn( SetupTask.NAME )
this.group = 'Node'
this.description = 'Setup a specific version of npm to be used by
the build.'
this.enabled = false
this.runner = new NpmExecRunner( this.project )
}
@Input
Set<String> getInput()
{
def set = new HashSet<>()
set.add( getConfig().download )
set.add( getConfig().npmVersion )
set.add( getConfig().npmWorkDir )
return set
}
@OutputDirectory
File getNpmDir()
{
return getVariant().npmDir
}
@Internal
ExecResult getResult()
{
return this.result
}
@Internal
protected getConfig()
{
if ( this.config != null )
{
return this.config
}
this.config = NodeExtension.get( this.project )
return this.config
}
@Internal
protected getVariant()
{
return getConfig().variant
}
List<?> getArgs()
{
return this.args
}
@Internal
void setArgs( final Iterable<?> value )
{
this.args = value.toList()
}
void setIgnoreExitValue( final boolean value )
{
this.runner.ignoreExitValue = value
}
void setExecOverrides( final Closure closure )
{
this.runner.execOverrides = closure
}
@TaskAction
void exec()
{
this.runner.arguments.addAll( this.args )
this.result = this.runner.execute()
}
void configureVersion( String npmVersion )
{
if ( !npmVersion.isEmpty() )
{
logger.debug( "Setting npmVersion to ${npmVersion}" )
setArgs( ['install', '--global', '--no-save', '--prefix',
getVariant().npmDir, "npm@${npmVersion}"] )
enabled = true
}
}
}