I'm trying to add a Test Kitchen for a bunch of cookbooks that we use to provision a Jenkins CI instance.
We use Berkshelf to manage dependencies. The file structure is as follows:
| .gitignore
| .kitchen.yml
| Berksfile
| Berksfile.lock
| bootstrap.sh
| chefignore
| metadata.rb
| provision.sh
| readme.md
| solo.json
| solo.rb
| tree.txt
| VERSION
|
+---.kitchen
| | default-ubuntu-1404.yml
| |
| +---kitchen-vagrant
| | \---kitchen-chef-jenkins-default-ubuntu-1404
| | | Vagrantfile
| | |
| | \---.vagrant
| | \---machines
| | \---default
| | \---virtualbox
| | action_set_name
| | id
| | index_uuid
| | private_key
| | synced_folders
| |
| \---logs
| default-centos-71.log
| default-ubuntu-1404.log
| kitchen.log
|
+---site-cookbooks
| +---ant
| | | .gitignore
| | | .kitchen.yml
| | | Berksfile
| | | CHANGELOG.md
| | | chefignore
| | | CONTRIBUTING.md
| | | LICENSE
| | | metadata.rb
| | | README.md
| | | TESTING.md
| | | Thorfile
| | |
| | +---attributes
| | | default.rb
| | |
| | +---providers
| | | library.rb
| | |
| | +---recipes
| | | default.rb
| | | install_package.rb
| | | install_source.rb
| | |
| | +---resources
| | | library.rb
| | |
| | \---templates
| | \---default
| | ant_home.sh.erb
| |
| +---haxe_cookbook
| | | CHANGELOG.md
| | | metadata.rb
| | | README.md
| | |
| | \---recipes
| | default.rb
| |
| \---mbp-jenkins
| | Berksfile
| | Berksfile.lock
| | CHANGELOG.md
| | chefignore
| | metadata.rb
| | README.md
| |
| +---recipes
| | default.rb
| |
| +---resources
| | | commons-net-3.3.jar
| | |
| | +---css
| | | style.css
| | |
| | +---images
| | | logo-mbp.png
| | | web.png
| | |
| | \---js
| | scripts.js
| |
| \---templates
| +---default
| | | config.xml
| | |
| | \---secrets
| | hudson.console.AnnotatedLargeText.consoleAnnotator
| | hudson.model.Job.serverCookie
| | hudson.util.Secret
| | jenkins.security.ApiTokenProperty.seed
| | jenkins.slaves.JnlpSlaveAgentProtocol.secret
| | master.key
| | org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.mac
| | org.jenkinsci.main.modules.instance_identity.InstanceIdentity.KEY
| |
| \---emails
| build-complete.html.groovy
| build-started.html.groovy
|
\---test
\---integration
\---default
Executing:
kitchen converge default-ubuntu-1404
Results in the following error:
[2015-08-24T09:13:24+00:00] ERROR: Cookbook mbp-jenkins not found. If you're loading mbp-jenkins from another cookbook, make sure you configure the dependency in your metadata
[2015-08-24T09:13:24+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Which suggests that chef-solo can't find the cookbook mbp-jenkins. I would expect it to find it though as we define the cookbook paths in the solo.rb file as follows:
root = File.absolute_path(File.dirname(__FILE__))
file_cache_path 'cache'
cookbook_path [root + "/cookbooks", root + "/site-cookbooks",root + "/berks-cookbooks"]
Not really sure what is going wrong here so any suggestions would be appreciated
Update:
I have tried using the chef zero provisioner, that however gives me the output:
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: mbp-jenkins
Expanded Run List:
------------------
* mbp-jenkins::default
Have you tried using the chef_zero provisioner instead? I suspect your problem is because chef solo does not run Berkshelf, which would explain the missing cookbooks.
For example see:
How to customise a tomcat recipe in Chef
Update
The issue appears to be that the cookbooks in the site-cookbooks directory is not be copied over to the target machine.
Seems to me the simplest and best fix is to include the local cookbooks in your Berksfile as follows:
source 'https://supermarket.chef.io'
cookbook 'ant', path: 'site-cookbooks/ant'
cookbook 'haxe_cookbook', path: 'site-cookbooks/haxe_cookbook'
cookbook 'mbp-jenkins', path: 'site-cookbooks/mbp-jenkins'
metadata
Related
I am currently developing a Spring Boot application in the Eclipse IDE with a Connection class which needs to know which data source to connect to. I decided to let it know this property from Spring's application.properties, through the #Value annotation:
#Value("${project.datasource}")
private final DataSource DATA_SOURCE;
where DataSource is an enum representing the possible data sources. However, in this method, I get a "Blank final field DATA_SOURCE may not have been initialized" error:
private DBConnection() throws SQLException {
ConnectionConfig config = new ConnectionConfig(DATA_SOURCE);
connection = DriverManager.getConnection(config.getUrl(), config.getUSERNAME(), config.getPASSWORD());
}
Inserting a default value doesn't work, either:
#Value("${project.datasource:POSTGRE_LOCAL}")
still gives the same error.
I tried to install the Spring Tools 4 plugin for Eclipse to check if this was just Eclipse not understanding the #Value annotation's implications, but it seems like this isn't the case. How do I solve this problem? Am I misunderstanding the implications myself?
application.properties:
project.datasource = POSTGRE_LOCAL
Project tree:
| .classpath
| .gitignore
| .project
| HELP.md
| mvnw
| mvnw.cmd
| pom.xml
|
+---.mvn
| \---wrapper
| maven-wrapper.jar
| maven-wrapper.properties
|
+---.settings
| org.eclipse.core.resources.prefs
| org.eclipse.jdt.core.prefs
| org.eclipse.m2e.core.prefs
| org.springframework.ide.eclipse.prefs
|
+---src
| +---main
| | +---java
| | | \---org
| | | \---ingsw21
| | | \---backend
| | | +---connection
| | | | DBConnection.java
| | | |
| | | +---controllers
| | | | UserController.java
| | | |
| | | +---DAOs
| | | | DAOUtente.java
| | | |
| | | +---DAOSQL
| | | | DAOSQLUtente.java
| | | |
| | | +---entities
| | | | Utente.java
| | | |
| | | +---enums
| | | | DataSource.java
| | | |
| | | \---exceptions
| | | BadRequestWebException.java
| | | DataAccessException.java
| | |
| | \---resources
| | application.properties
| |
| \---test
| \---java
| \---org
| \---ingsw21
| \---backend
| \---BackEnd
| BackEndApplicationTests.java
|
\---target
+---classes
| | application.properties
| |
| \---org
| \---ingsw21
| \---backend
| +---connection
| | DBConnection$ConnectionConfig.class
| | DBConnection.class
| |
| +---controllers
| | UserController.class
| |
| +---DAOs
| | DAOUtente.class
| |
| +---DAOSQL
| | DAOSQLUtente.class
| |
| +---entities
| | Utente.class
| |
| +---enums
| | DataSource.class
| |
| \---exceptions
| BadRequestWebException.class
| DataAccessException.class
|
\---test-classes
\---org
You cannot add #Value to a final field.
#Value("${project.datasource}")
private DataSource DATA_SOURCE;
should work just fine.
Reverse the "$" and "{". The expression syntax is "${...}".
I wish to get the returned value of status with shell then I can process to next command
# glance image-show 0227a985-cb1e-4f0c-81cb-003411988ea5
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2021-03-15T02:54:15Z |
| disk_format | raw |
| hw_disk_bus | scsi |
| hw_qemu_guest_agent | yes |
| hw_scsi_model | virtio-scsi |
| id | 0227a985-cb1e-4f0c-81cb-003411988ea5 |
| locations | [] |
| min_disk | 0 |
| min_ram | 0 |
| name | not_inuse |
| os_hash_algo | None |
| os_hash_value | None |
| os_hidden | False |
| os_require_quiesce | yes |
| owner | 4d97a99e53bd4b51aa58601985776d5c |
| protected | False |
| size | None |
| status | active |
| tags | [] |
| updated_at | 2021-03-15T02:54:30Z |
| virtual_size | Not available |
| visibility | private |
+---------------------+--------------------------------------+
How do I get the printed value = active ??
# glance image-show 0227a985-cb1e-4f0c-81cb-003411988ea5 | grep status
| status | active |
Please help, Thank you
# glance image-show 0227a985-cb1e-4f0c-81cb-003411988ea5 | grep status | awk '{print $4}'
active
I'm facing a problem with Config Processing error (circle-ci).
Material that I use
Aws cloud front
aws s3
circle-ci
situation
I did set up on AWS and added value to Environment Variables (circle-ci ). I did commit on git and build on circle-ci and an error occurs and I could not get out this error.
This is my repo
error
bin/sh -eo pipefail
ERROR IN CONFIG FILE:
[#/jobs] 8 schema violations found
Any string key is allowed as job name.
1. [#/jobs/deploy-to-aws-cloudfront] 0 subschemas matched instead of one
| 1. [#/jobs/deploy-to-aws-cloudfront] only 1 subschema matches out of 2
| | 1. [#/jobs/deploy-to-aws-cloudfront] 3 schema violations found
| | | 1. [#/jobs/deploy-to-aws-cloudfront] required key [steps] not found
| | | 2. [#/jobs/deploy-to-aws-cloudfront/docker/0] 2 schema violations found
| | | | 1. [#/jobs/deploy-to-aws-cloudfront/docker/0] extraneous key [steps] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| | | | 2. [#/jobs/deploy-to-aws-cloudfront/docker/0] extraneous key [working_directory] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| 2. [#/jobs/deploy-to-aws-cloudfront] expected type: String, found: Mapping
| | Job may be a string reference to another job
2. [#/jobs/deploy-to-aws-s3] 0 subschemas matched instead of one
| 1. [#/jobs/deploy-to-aws-s3] only 1 subschema matches out of 2
| | 1. [#/jobs/deploy-to-aws-s3] 3 schema violations found
| | | 1. [#/jobs/deploy-to-aws-s3] required key [steps] not found
| | | 2. [#/jobs/deploy-to-aws-s3/docker/0] 2 schema violations found
| | | | 1. [#/jobs/deploy-to-aws-s3/docker/0] extraneous key [steps] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| | | | 2. [#/jobs/deploy-to-aws-s3/docker/0] extraneous key [working_directory] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| 2. [#/jobs/deploy-to-aws-s3] expected type: String, found: Mapping
| | Job may be a string reference to another job
-------
Warning: This configuration was auto-generated to show you the message above.
Don't rerun this job. Rerunning will have no effect.
false
The reason that the Config processing error was ignoring schema on a circle-ci.
In my case, that's an indentation error.
https://github.com/CircleCI-Public/circleci-cli/issues/326
This post was helpful for solving my error.
How to launch and LXD container on another node and exchange ssh keys with the container?
That is, how to give Ansible direct access to the LXD container using SSH?
I am aware of the authorized_key module however this would only exchange keys between the host and Ansible and not Ansible and the LXD container.
Please see the below diagram which describes the machine layout:
+----------------------------+ +----------------------------+
| | | |
| Baremetal Machine <------------------+ Ansible Machine |
| + | | |
| | | | |
| | | | |
| | | | |
| +--------------------+ | | |
| | | | | | |
| | v | | | |
| | LXD Container | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| +--------------------+ | | |
| | | |
+----------------------------+ +----------------------------+
Start containers from images that support some sort of provisioning system.
Most common is cloud-init – it's already inside many official cloud images.
When you create such a container, just add required configuration settings via user.user-data config option and it will be automatically applied when container started.
lxd_container module support config parameter to set container configuration options.
You can find useful cloud config examples here.
The project runs as expected with spring-boot:run. However, the executable JAR fails to run because it cannot find db/changelog.xml.
The following steps can be used to reproduce the problem:
run mvn package from project root
go to target folder
run java -jar executable-jar-with-liquibase-1.0.0-SNAPSHOT.jar
The log will now show an error because the table domain has not been created.
Note that the application.yml is found, since if liquibase.enabled is set to false, it will refuse to run entirely (as it should).
application.yml
server:
context-path: /api
spring:
datasource:
platform: h2
url: jdbc:h2:mem:testdb;MODE=PostgreSQL;DB_CLOSE_ON_EXIT=FALSE
jackson:
date-format: yyyy-MM-dd
jpa:
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: none
liquibase:
enabled: false
change-log: classpath:db/changelog.xml
The generated JAR has the following contents:
.
|____BOOT-INF
| |____classes
| | |____application.yml
| | |____db
| | | |____changelog.xml
| | | |____changelogs
| | | | |____changelog_000.xml
| | |____nl
| | | |_____42
| | | | |____app
| | | | | |____ApplicationConfig.class
| | | | | |____domain
| | | | | | |____Domain.class
| | | | | | |____DomainController.class
| | | | | | |____DomainRepository.class
| | | | | | |____DomainService.class
| | | | | |____shared
| | | | | | |____AbstractEntity.class
| | | | | |____WebAppConfig.class
| | | | | |____WebApplication.class
| |____lib
| | |____accessors-smart-1.1.jar
| | |____antlr-2.7.7.jar
| | |____asm-5.0.3.jar
| | |____aspectjweaver-1.8.9.jar
| | |____assertj-core-2.5.0.jar
| | |____classmate-1.3.1.jar
| | |____dom4j-1.6.1.jar
| | |____h2-1.4.192.jar
| | |____hamcrest-core-1.3.jar
| | |____hamcrest-library-1.3.jar
| | |____hibernate-commons-annotations-5.0.1.Final.jar
| | |____hibernate-core-5.0.11.Final.jar
| | |____hibernate-entitymanager-5.0.11.Final.jar
| | |____hibernate-jpa-2.1-api-1.0.0.Final.jar
| | |____hibernate-validator-5.2.4.Final.jar
| | |____jackson-annotations-2.8.3.jar
| | |____jackson-core-2.8.3.jar
| | |____jackson-databind-2.8.3.jar
| | |____jackson-datatype-jsr310-2.8.3.jar
| | |____jandex-2.0.0.Final.jar
| | |____javassist-3.20.0-GA.jar
| | |____javax.transaction-api-1.2.jar
| | |____jboss-logging-3.3.0.Final.jar
| | |____jcl-over-slf4j-1.7.21.jar
| | |____json-20140107.jar
| | |____json-path-2.2.0.jar
| | |____json-smart-2.2.1.jar
| | |____jsonassert-1.3.0.jar
| | |____jul-to-slf4j-1.7.21.jar
| | |____liquibase-core-3.5.1.jar
| | |____log4j-over-slf4j-1.7.21.jar
| | |____logback-classic-1.1.7.jar
| | |____logback-core-1.1.7.jar
| | |____mockito-core-1.10.19.jar
| | |____objenesis-2.1.jar
| | |____slf4j-api-1.7.21.jar
| | |____snakeyaml-1.17.jar
| | |____spring-aop-4.3.3.RELEASE.jar
| | |____spring-aspects-4.3.3.RELEASE.jar
| | |____spring-beans-4.3.3.RELEASE.jar
| | |____spring-boot-1.4.1.RELEASE.jar
| | |____spring-boot-autoconfigure-1.4.1.RELEASE.jar
| | |____spring-boot-configuration-processor-1.4.1.RELEASE.jar
| | |____spring-boot-devtools-1.4.1.RELEASE.jar
| | |____spring-boot-starter-1.4.1.RELEASE.jar
| | |____spring-boot-starter-aop-1.4.1.RELEASE.jar
| | |____spring-boot-starter-data-jpa-1.4.1.RELEASE.jar
| | |____spring-boot-starter-jdbc-1.4.1.RELEASE.jar
| | |____spring-boot-starter-logging-1.4.1.RELEASE.jar
| | |____spring-boot-starter-test-1.4.1.RELEASE.jar
| | |____spring-boot-starter-tomcat-1.4.1.RELEASE.jar
| | |____spring-boot-starter-web-1.4.1.RELEASE.jar
| | |____spring-boot-test-1.4.1.RELEASE.jar
| | |____spring-boot-test-autoconfigure-1.4.1.RELEASE.jar
| | |____spring-context-4.3.3.RELEASE.jar
| | |____spring-core-4.3.3.RELEASE.jar
| | |____spring-data-commons-1.12.3.RELEASE.jar
| | |____spring-data-jpa-1.10.3.RELEASE.jar
| | |____spring-expression-4.3.3.RELEASE.jar
| | |____spring-jdbc-4.3.3.RELEASE.jar
| | |____spring-orm-4.3.3.RELEASE.jar
| | |____spring-tx-4.3.3.RELEASE.jar
| | |____spring-web-4.3.3.RELEASE.jar
| | |____spring-webmvc-4.3.3.RELEASE.jar
| | |____tomcat-embed-core-8.5.5.jar
| | |____tomcat-embed-el-8.5.5.jar
| | |____tomcat-embed-websocket-8.5.5.jar
| | |____tomcat-jdbc-8.5.5.jar
| | |____tomcat-juli-8.5.5.jar
| | |____validation-api-1.1.0.Final.jar
| | |____xml-apis-1.4.01.jar
|____META-INF
| |____MANIFEST.MF
| |____maven
| | |____nl.mad
| | | |____executable-jar-with-liquibase
| | | | |____pom.properties
| | | | |____pom.xml
|____org
| |____springframework
| | |____boot
| | | |____loader
| | | | |____archive
| | | | | |____Archive$Entry.class
| | | | | |____Archive$EntryFilter.class
| | | | | |____Archive.class
| | | | | |____ExplodedArchive$1.class
| | | | | |____ExplodedArchive$FileEntry.class
| | | | | |____ExplodedArchive$FileEntryIterator$EntryComparator.class
| | | | | |____ExplodedArchive$FileEntryIterator.class
| | | | | |____ExplodedArchive.class
| | | | | |____JarFileArchive$EntryIterator.class
| | | | | |____JarFileArchive$JarFileEntry.class
| | | | | |____JarFileArchive.class
| | | | |____data
| | | | | |____ByteArrayRandomAccessData.class
| | | | | |____RandomAccessData$ResourceAccess.class
| | | | | |____RandomAccessData.class
| | | | | |____RandomAccessDataFile$DataInputStream.class
| | | | | |____RandomAccessDataFile$FilePool.class
| | | | | |____RandomAccessDataFile.class
| | | | |____ExecutableArchiveLauncher$1.class
| | | | |____ExecutableArchiveLauncher.class
| | | | |____jar
| | | | | |____AsciiBytes.class
| | | | | |____Bytes.class
| | | | | |____CentralDirectoryEndRecord.class
| | | | | |____CentralDirectoryFileHeader.class
| | | | | |____CentralDirectoryParser.class
| | | | | |____CentralDirectoryVisitor.class
| | | | | |____FileHeader.class
| | | | | |____Handler.class
| | | | | |____JarEntry.class
| | | | | |____JarEntryFilter.class
| | | | | |____JarFile$1.class
| | | | | |____JarFile$2.class
| | | | | |____JarFile$3.class
| | | | | |____JarFile$JarFileType.class
| | | | | |____JarFile.class
| | | | | |____JarFileEntries$1.class
| | | | | |____JarFileEntries$EntryIterator.class
| | | | | |____JarFileEntries.class
| | | | | |____JarURLConnection$1.class
| | | | | |____JarURLConnection$JarEntryName.class
| | | | | |____JarURLConnection.class
| | | | | |____ZipInflaterInputStream.class
| | | | |____JarLauncher.class
| | | | |____LaunchedURLClassLoader$1.class
| | | | |____LaunchedURLClassLoader.class
| | | | |____Launcher.class
| | | | |____MainMethodRunner.class
| | | | |____PropertiesLauncher$1.class
| | | | |____PropertiesLauncher$ArchiveEntryFilter.class
| | | | |____PropertiesLauncher$FilteredArchive$1.class
| | | | |____PropertiesLauncher$FilteredArchive.class
| | | | |____PropertiesLauncher$PrefixMatchingArchiveFilter.class
| | | | |____PropertiesLauncher.class
| | | | |____util
| | | | | |____SystemPropertyUtils.class
| | | | |____WarLauncher.class
The entire project can be found here: https://github.com/robert-bor/executable-jar-with-liquibase
What am I doing wrong here?
there used to be a problem with the includeAll tag in liquibase, see this issue. It should be fix meanwhile, but at the moment I could not make it run with the includeAll tag.
As a solution for your problem use:
<include file="classpath:db/changelogs/changelog_000.xml" relativeToChangelogFile="false"/>