I have a seed job that is based off of DSL. This is what is looks like
pipelineJob("job name") {
description('Some explanation')
triggers {
cron('#midnight')
upstream('someJob', 'SUCCESS')
}
parameters {
...
When I run the job, it ends up being unstable with the error message
Warning: (Builds.groovy, line 53) triggers is deprecated
So now Ive re written the code as follows
pipelineJob("job name") {
description('Some explanation')
properties {
pipelineTriggers {
triggers {
cron('#midnight')
upstream('someJob', 'SUCCESS')
}
}
parameters {
...
And now I get the error
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.cron() is applicable for argument types: (java.lang.String) values: [#midnight]
Possible solutions: grep(), print(java.io.PrintWriter), print(java.lang.Object), grep(java.lang.Object), wait(), any()
Now ive re-written it as
pipelineJob("job name") {
description('Some explanation')
properties {
pipelineTriggers {
triggers {
cron{
spec('#midnight')
}
upstream('someJob', 'SUCCESS')
}
}
parameters {
...
But now this ends up with the error
ERROR: (Builds.groovy, line 72) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.upstream() is applicable for argument types: (java.lang.String, java.lang.String) values: [someJob, SUCCESS]
What else have I missed here ?
Using the URL <JENKINS_URL>/plugin/job-dsl/api-viewer/index.html#path/pipelineJob-properties-pipelineTriggers-triggers
I got the correct format
properties {
pipelineTriggers {
triggers {
cron {
spec('#midnight')
}
upstream{
upstreamProjects('someJob')
threshold('SUCCESS')
}
}
}
}
Related
I am attempting to use a global beforeeach() algorithm defined in support/e2e to filter tests. This code works.
beforeEach(function () {
var testSuite = new Array();
testSuite = (Cypress.env('suites'));
if (!testSuite) {
return;
}
const testName = Cypress.mocha.getRunner().test.fullTitle().toLowerCase();
let matches = testSuite.some((value) => {
return (testName.includes(value))
});
if (!matches) {
this.skip();
}
return;
})
However, when using in conjunction with cypress-failed-log, tests that are skipped because of the prior algorithm are failing with this error:
TypeError: Cannot read properties of undefined (reading 'message')
Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
at Context.onFailed (webpack:///./node_modules/cypress-failed-log/src/index.js:136:0)
This is what my plug in looks like. It works independent of the sorting algorithm and fails with the same message even if I only leave just the failed:required line and remove the code that uses the message object.
on('task', {
failed: require('cypress-failed-log/src/failed')()
,
log(message) {
console.log(message)
return null
},
table(message) {
console.table(message)
return null
}
})
I have the following pipeline:
pipeline {
agent any
stages {
stage('CI') {
parallel {
stage('גמלאות') {
steps {
input message: "Pass Sanity?"
}
}
stage('וועדות') {
steps {
input message: "Pass Sanity?"
}
}
stage('מבוטח') {
steps {
input message: "Pass Sanity?"
}
}
}
}
}
}
I'm expecting to see in the UI 3 option to select in each stage. but getting only one instead.
If I will look at tradinall console then I will be able to select if to proceed or to abort.
Is there a way to get this function thru the UI?
Here is an example of the UI:
It seems that the code is correct. The problem is with the Jenkins plugin.
I mooved to work with Blueocean plugin, and now it seems to work fine:
in Strapi 4.0, i want to validate the input before saving. So i created lifecycles.js file as per the documentation and added the code:
module.exports = {
beforeCreate(event) {
//validation login here;
if (!valid) {
throw strapi.errors.badRequest('Invalid Entry');
}
},
}
How ever throw strapi.errors.badRequest('Invalid Entry'); is giving an error :
Cannot read property 'badRequest' of undefined
My guess is the Strapi v4 changed it from version 3. I looked everywhere but couldn't find a solution.
Any idea on how to handle error in lifecycles.js?
I had a similar situation with a forbidden error. I got to do it importing a class from #strapi/utils/lib/errors.js
const { ForbiddenError } = require("#strapi/utils").errors;
...
if (!authorized) {
throw new ForbiddenError(errorMessage);
}
You can show the list of errors based on your requirement
const { ValidationError } = require("#strapi/utils").errors;
...
if (formValidationError) {
throw new ForbiddenError("Fill the form");
}
Strapi comes with a lot of error response functions here are they
HttpError,
ApplicationError,
ValidationError,
YupValidationError,
PaginationError,
NotFoundError,
ForbiddenError,
PayloadTooLargeError,
UnauthorizedError,
PolicyError,
I am testing if i can upload files to my artifactory i keep getting this error
Bitbucket] Build result notified
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('/' (code 47)): maybe a (non-
standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)
at [Source: UNKNOWN; line: 1, column: 2]
My pipeline looks like this, my Node is running on windows
pipeline {
agent {
node {
label 'MYNODE'
}
}
stages {
stage ('Clone') {
steps {
git branch: 'master', url: "https://bitbucket.myorg.com/scm/dwhdat/testdeploy.git"
}
}
stage ('Upload') {
steps {
withCredentials([usernamePassword(credentialsId: 'xxxxxxxxxxxxxxxxx', passwordVariable: 'USER_PASS', usernameVariable: 'USER_NAME')]) {
rtUpload (
serverId: 'dwh-art',
specPath: 'src\\etl\\mysasprogram.sas'
)
}
}
}
}
}
the Clone steps runs ok, but somehow it wont par my specPath, can anyone see whats wrong with this.
I did manage to solve this my self,
we need to specify some Json in the rtUpload then it works.
stage ('Upload') {
steps {
usernameVariable: 'ARTIFACTORY_USER')]) {*/
rtUpload serverId: "${ARTIFACTORY_SERVER}",
spec: """{
"files":[ {
"pattern": "${ZIP_FILE_NAME}",
"target": "${ARTIFACTORY_REPO}"
}
]
}"""
/* } */
}
The reason i get this error (//) it was a comment mark
{
//"type":"test"
"date":"01-01-1988",
"color":"Black"
}
It should have been like this when using Postman request
{
"type":"test",
"date":"01-01-1988",
"color":"Black"
}
Iam working on creating a Build promotion using Jenkins-JOb DSL-Paramterized build.
My Scripts looks as,
Job('sampleMavenProj') {
triggers { scm("*/5 * * * *") }
scm { git('file:///work/SampleTest') }
rootPOM("pom.xml")
goals('clean')
wrappers {
preBuildCleanup()
release {
preBuildSteps {
maven {
rootPOM('pom.xml')
goals("build-helper:parse-version")
goals("versions:set")
}
}
postSuccessfulBuildSteps {
maven {
rootPOM('pom.xml')
goals("package")
}
}
}
}
}
promotions("") {
promotion("Development") {
icon("star-red")
conditions {
manual('')
}
actions {
shell('echo This is a DownStream Job;')
}
}
But when i build the JOb , it fails saying ,
Processing provided DSL script
ERROR: (script, line 31) No signature of method: script.promotions() is applicable for argument types: (java.lang.String, script$_run_closure2) values: [, script$_run_closure2#4fcac57f]
Finished: FAILURE
Which is at , promotions area. Please let me on this.
Thanks for all the responses.
Seems like the Prompted build plugin that i am using is not working. I have to use the 2.26 version from"https://github.com/Russell-IO/promoted-builds-plugin/releases" to use the code. This solved my issues. thanks