I am running below command from Linux(Centos) terminal,
mvn --settings /home/centos/.m2/jenkins/liquibase-settings.xml -e resources:resources -Pdev -Dliquibase.promptOnNonLocalDatabase=false -Dliquibase.defaultSchemaName=MYDEV_SCHEMA liquibase:updateSQL liquibase:update -Dsettings.security=/home/centos/.m2/jenkins/liquibase-security-settings.xml -Dfile.encoding=UTF-8
Everything went fine.
Same thing when I run via Jenkins, getting below,
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.0:updateSQL (default-cli) on project project-db:
[ERROR] Error setting up or running Liquibase:
[ERROR] Validation Failed:
[ERROR] 16 change sets check sum
[ERROR] db/changelog/ABCD.xml::1234-23::User1 was: 8:67913d9505606eeaaa4998fd594a8ccf but is now: 8:9d985650b579319df50f30732d66909c
[ERROR] db/changelog/ABCD.xml::1234-78::User1 was: 8:3b3babd5d0712f846402af13ede528f7 but is now: 8:0214bf10acfd160fc6f7d709edab2f2e
[ERROR] db/changelog/ABCD.xml::1234-142::User1 was: 8:5e3c8fc77fc87f0e9740c0bff717f579 but is now: 8:53094dd8c32ec71b8d76fdd71009c548
[ERROR] db/changelog/ABCD.xml::1234-200::User1 was: 8:c40ec5c77f7b10961ee550edd756f51f but is now: 8:9bef09eb0681f7ea7bf827b6ac136433
[ERROR] db/changelog/ABCD.xml::1234-923::User1 was: 8:747cbcbda155679dd2fc1bfcc40991c4 but is now: 8:68c8046c220b8d2eb46ed3ac07ebc2a2
[ERROR] db/changelog/ABCD.xml::1234-952::User1 was: 8:ecaad2afacf6c61f18e08cb3e235292a but is now: 8:0f7f9087de5cc2e62a96a86988d07a9d
[ERROR] db/changelog/ABCD.xml::1234-955::User1 was: 8:3ddd6fd25fb4a68accf50190b3ab6738 but is now: 8:8ebed2810bad45ace402f99a957a2c5a
[ERROR] db/changelog/ABCD.xml::1234-957::User1 was: 8:cc6144775a784d10bc4523dccae02c2e but is now: 8:f0fb84fb3a677e760b5bbad3149e8a17
[ERROR] db/changelog/ABCD.xml::1234-958::User1 was: 8:b0c71a212949df4863ce622e61315cee but is now: 8:9c6ea7b8f8cb3f6e65871085527fa4c5
[ERROR] db/changelog/ABCD.xml::1234-960::User1 was: 8:b0966c55100b0a2daae7dd34b7d1849f but is now: 8:5db8b313d34612e1a0035caa73bfae2d
[ERROR] db/changelog/ABCD.xml::1234-961::User1 was: 8:3e3b96c656362b5bed959428772efbdf but is now: 8:622c3530660fa51cfb806cc454736a8e
[ERROR] db/changelog/ABCD.xml::1234-964::User1 was: 8:50e079098e7d2be9e1299d68717af265 but is now: 8:13ab1763f5f21e80dc5f7aa714916f01
[ERROR] db/changelog/ABCD.xml::1234-971::User1 was: 8:fe000258281e834309f9454077e4935d but is now: 8:b238dad4489c9683a3e362820a0ba715
[ERROR] db/changelog/ABCD.xml::1234-974::User1 was: 8:578a1f3510ac700373b40d83ffbfcdde but is now: 8:3eeb6e61dec24eac4148a6c66033e125
[ERROR] db/changelog/ABCD.xml::100000011::User1 was: 8:5d0882f8413b6d1063ab023e7c4ec917 but is now: 8:e019e12a40add4536a128ba7b9b06f69
[ERROR] db/changerequest/ABCD/ABCD.1_Base.xml::ABCD1-100000211::User1 was: 8:9ea4f4f4b5a2db0d1c7e439887e9129c but is now: 8:ebe390648144994233ecd6101e04380c
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.0:updateSQL (default-cli) on project project-db:
My Jenkins code,
dir("${liquibase_working_dir}"){
configFileProvider([
configFile(fileId: 'liquibase-settings.xml', variable: 'LIQUIBASE_SETTINGS'),
configFile(fileId: 'liquibase-security-settings.xml', variable: 'LIQUIBASE_SECURITY_SETTINGS'),
]) {
withMaven(maven:'maven', mavenSettingsFilePath: "${LIQUIBASE_SETTINGS}") {
sh "mvn -e resources:resources liquibase:updateSQL liquibase:update -P${env_lowercase} \"-Dsettings.security=${LIQUIBASE_SECURITY_SETTINGS}\" -Dliquibase.promptOnNonLocalDatabase=false -Dliquibase.defaultSchemaName=${schema} -Dfile.encoding=UTF-8"
}
}
sh "cp target/liquibase/migrate.sql target/liquibase/${env_lowercase}-${currentBuild.number}-${schema}-updates.sql"
}
I missed an important point, there are no commits to the liquibase repository.
When Liquibase reaches a changeset, it computes a checksum for it and stores it in the DATABASECHANGELOG table. The value of storing the checksum for Liquibase is to know if the changeset has been modified since it was run.
If the changeset has been changed since it was run, Liquibase will exit the migration with an error message like Validation failed: change set check sums <changeset identifer> was: <old checksum> but is now: <newchecksum>. This is because Liquibase cannot identify what was changed and the database may be in a state different than what the changelog is expecting.
To ignore this error on valid change made in changeset, there are below options:
1. clearCheckSums : clearCheckSums clears all checksums and nullifies the MD5SUM column of the DATABASECHANGELOG table so they will be re-computed on the next database update.Changesets that have been deployed will have their checksums re-computed, and pending changesets will be deployed. For more details about this approach, please visit this link
2. runOnChange attribute : The runOnChange attribute executes the change the first time it is seen and each time the changeset is modified. For more details about this approach, please visit this link
3. runAlways attribute : Executes the changeset on every run, even if it has been run before. To use this, set attribute runAlways = true in your changeset. Example as below:
<changeSet id="liquibase-0" author="liquibase" runAlways="true">
<sqlFile relativeToChangelogFile="true" path="db/file.sql"/>
</changeSet>
4. The <validCheckSum> attribute : Add a element to the changeset. The text contents of the element should contain the old checksum from the error message.
5. Manual update of the DATABASECHANGELOG table : The first option is to manually update the DATABASECHANGELOG table so that the row with the corresponding id/author/filepath has a null value for the checksum. You would need to do this for all environments where the changeset has been deployed. The next time you run the Liquibase update command, it will update the checksum value to the new correct value.
Cheers!!
Related
I'm using RabbitMQ 3.8.5-management with the following config:
log.file = rabbit.log
log.dir = /var/log/rabbitmq
log.file.level = info
log.file.formatter = json
log.file.rotation.date = $D0
I get the following error:
12:45:12.131 [error] You've tried to set log.file.formatter, but there is no setting with that name.
12:45:12.134 [error] Did you mean one of these?
12:45:12.182 [error] log.file.level
12:45:12.182 [error] log.file
12:45:12.182 [error] log.file.rotation.date
12:45:12.182 [error] Error preparing configuration in phase transform_datatypes:
12:45:12.183 [error] - Conf file attempted to set unknown variable: log.file.formatter
According to the documentation log.file.formatter should work - what is wrong?
checked documentation on RabbitMQ.
checked other SO posts.
entered the container and remove the config - it works without it.
Looks like JSON logging and the log.file.formatter setting was added with RabbitMQ 3.9.0 release.
Try upgrading if possible.
I am trying to encrypt the password using maven by following this link- Generate settings-security.xml file for maven password encryption. But, in the step after creating master password and creating the file settings-security.xml, but while trying to run the command- mvn --encrypt-password '!12345', I am getting the following error:
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
[ERROR] Caused by: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
abhinashkumarjha#C02DP5F7MD6R ~ % mvn --encrypt-password '!Abhi#090342'
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
[ERROR] Caused by: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
My settings-security.xml looks like this:
<settingsSecurity>
<master{42xI34HcwGIH/t9Bhr5P4ctsVIjOtvPO81b2eb9uYWY=}</master>
</settingsSecurity>
Thanks in Advance!!
I am new to Elixir/Erlang. As I need to setup an existing application, I am executing below step to generate migrations:
mix ecto.migrate
After migrating 9 tables, everytime it is throwing following error:
<b> 00:55:30.074 [error] Mariaex.Protocol (#PID<0.415.0>) disconnected: ** (Mariaex.Error) [tcp] `recv` failed with: :timeout </b>
I am really stuck here and do not know how to move ahead. Theare are around 175 migration files.
I tried to re-run the migrations command but that is not working.
Probably the migration whos generate this error performs a long operation and exceeds your MariaDB/MySQL timeout.
Try increase your timeouts for this operation:
https://hexdocs.pm/ecto/Ecto.Repo.html#module-shared-options
I'm running a Jenkins 2.25 server on Windows Server 2012. At the moment we're using the Maven Integration Plugin 2.12.1 and the Job DSL Plugin 1.57.
I've written DSL scripts for around 200 existing jobs on our server.
For any jobs that use Maven, either as a build step or as an actual Maven, I'm having a really frustrating issue. When I run the generated jobs, they fail with the following output.
12:17:12 [ERROR] Failed to execute goal com.googlecode.maven-download- plugin:download-maven-plugin:1.3.0:wget (default) on project myprojecy: The parameters 'url' for goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.0:wget are missing or invalid -> [Help 1]
12:17:12 [ERROR]
12:17:12 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
12:17:12 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
12:17:12 [ERROR]
12:17:12 [ERROR] For more information about the errors and possible solutions, please read the following articles:
12:17:12 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
Initially we thought we identified the issue as being that we were missing the XML snippet, even thought it appeared these settings were as they should be in the UI.
<settings class="jenkins.mvn.DefaultSettingsProvider"/>
<globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
<injectBuildVariables>false</injectBuildVariables>
So added this to the scripts:
configure { node ->
node / settings (class: 'jenkins.mvn.DefaultSettingsProvider') {
}
node / globalSettings (class: 'jenkins.mvn.DefaultGlobalSettingsProvider') {
}
node / injectBuildVariables ('false') {
}
}
But the jobs still fail when I try to run them, even though the XML now contained this snippet as expected.
Now two very bizarre things that I can't work out which are clearly related. Firstly, after the jobs fail, if I manually select "configure" for the job, then save it (i.e. don't make any actual changes), the job runs fine forever more (until a seed job us run and then it fails again).
Secondly, in the job config history after I run the seed job, I see the changes made when the seed job runs under the System user. However, within a matter of seconds, every time, another configuration change is recorded under my username, despite the fact that I have not made any changes to the job config - this is independent of me saving the job without making changes, by the way, it happens instantly.
I should add that further inspection suggests to me that there is some default settings for Maven which are not being applied to my DSL generated jobs. When adding the -X switch to the Maven goals, I could see more information about where these jobs are failing. The output is:
15:06:31 [DEBUG] Goal: com.googlecode.maven-download-plugin:download-maven-plugin:1.3.0:wget (default)
15:06:31 [DEBUG] Style: Regular
15:06:31 [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
15:06:31 <configuration>
15:06:31 <cacheDirectory>${download.cache.directory}</cacheDirectory>
15:06:31 <checkSignature default-value="false">${checkSignature}</checkSignature>
15:06:31 <failOnError default-value="true"/>
15:06:31 <outputDirectory default-value="${project.build.directory}">D:\data\jenkins\workspace\project\target</outputDirectory>
15:06:31 <outputFileName>${jarsigner.keystore.filename}</outputFileName>
15:06:31 <overwrite>${download.overwrite}</overwrite>
15:06:31 <readTimeOut default-value="0"/>
15:06:31 <retries default-value="2"/>
15:06:31 <session>${session}</session>
15:06:31 <skip default-value="false">${download.plugin.skip}</skip>
15:06:31 <skipCache default-value="false"/>
15:06:31 <unpack default-value="false">false</unpack>
15:06:31 <url>${jarsigner.keystore.url}</url>
15:06:31 </configuration>
Where in the successful run of the job (post fake config change) some of those fields are full, for example a URL for the keystore. This is obviously the problem, but I don't know what to do. As far as I can tell this should be resolved by including the configure block above in the groovy, but somehow my jobs are missing this (but they have it after saving the job again with no changes).
Can anyone see what I am doing wrong here?
The issue is this code in the XML which is automatically generated:
<jvmOptions></jvmOptions>
It seems that despite being empty this is overriding any default Maven options but then when the job gets saved again this is taken out because it is empty. Resolved by adding this to the groovy script:
configure({
it.remove(it / 'jvmOptions')
})
This seems likely to be a bug in the DSL but it's surprising that my colleagues and I have been unable to find any mention of this. Anyway, the above resolved this for me.
I want to integrate the Specs2 test results with Jenkins.
I was added the below properties in sbt:
resolver:
"maven specs2" at "http://mvnrepository.com/artifact"
libraryDependencies:
"org.specs2" %% "specs2" % "2.0-RC1" % "test",
System Property:
testOptions in Test += Tests.Setup(() => System.setProperty("specs2.outDir", "/target/specs2-reports")) //Option1
//testOptions in Test += Tests.Setup(() => System.setProperty("specs2.junit.outDir", "/target/specs2-reports")) //Option2
testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "console", "junitxml")
If I run the below command, it is not generating any specs reports in the above mentioned directory("/target/specs2-reports").
sbt> test
If I run the below command, it is asking for the directory as shown in the below error message:
sbt> test-only -- junitxml
[error] Could not run test code.model.UserSpec: java.lang.IllegalArgumentException: junitxml requires directory to be specified, example: junitxml(directory="xxx")
And it is working only if I give the directory as shown below:
sbt> test-only -- junitxml(directory="\target\specs-reports")
But sometimes its not generating all the specs report xmls (some times generating only one report, sometimes only two reports etc.).
If I give test-only -- junitxml(directory="\target\specs-reports") in the jenkins it is giving the below error.
[error] Not a valid key: junitxml (similar: ivy-xml)
[error] junitxml(
[error] ^
My main goal is, I want to generate the consolidated test reports in junit xml format and integrate with Jenkins. Kindly help me to solve my problem.
Best Regards,
Hari
The option for the junitxml output directory is: "specs2.junit.outDir" and the default value is "target/test-reports".
So if you don't change anything you could just instruct Jenkins to grab the xml files from "target/test-reports" which is what I usually do.
Also you might have to enclose your sbt commands in Jenkins with quotes. This is what I typically do:
"test-only -- html junitxml console"