cookbook 'artifact-deployer', '~> 0.8.18'
artifact-deployer
(17) Versions
0.8.18
-
Follow2
A Chef Cookbook that provides a simple way to download, unpack and configure artifacts
cookbook 'artifact-deployer', '~> 0.8.18', :supermarket
knife supermarket install artifact-deployer
knife supermarket download artifact-deployer
Artifact Deployer
A Chef Cookbook that provides a simple way to download, unpack and patch artifacts.
Download is offered via
- Maven GAV coordinates
- HTTP Url
- File-system path
- S3 (file copy and bucket sync)
Artifact sources
Configuration is done via Chef JSON attributes; hereby are examples for each source type.
Maven artifacts
"artifacts": {
"alfresco": {
"enabled": true,
"groupId": "org.alfresco",
"artifactId": "alfresco",
"type": "war",
"version": "5.0.a",
"destination": "/var/lib/tomcat7/webapps",
"owner": "tomcat7"
}
}
Downloads alfresco
WAR artifact and copies as /var/lib/tomcat7/webapps/alfresco.war
You can add Maven Repositories as artifact sources defining maven_repos
databag item, as follows:
{
"id" : "my-repo",
"url" : "https://my-repo.com/mvnrepo",
"username" : "user",
"password" : "pwd"
}
Check test maven_repos databags for more samples.
HTTP URL
"artifacts": {
"junit": {
"enabled": true,
"url": "https://repo1.maven.org/maven2/junit/junit/4.9/junit-4.9.jar",
"destination": "/var/lib/tomcat7/lib",
"owner": "tomcat7"
}
}
Downloads junit-4.9.jar
and copies as /var/lib/tomcat7/lib/junit.jar
File-system path
"artifacts": {
"my-local-zip": {
"enabled": true,
"path": "/root/folder/my-zip.zip",
"destination": "/opt",
"owner": "myuser"
}
}
Copies /root/folder/my-zip.zip
into /opt/my-local-zip.zip
S3
If you want to sync a bucket with a local folder
"artifacts": {
"my-s3-bucket-folder": {
"enabled": true,
"s3_bucket" : "artifact-deployer-test",
"destination": "/opt",
"owner": "myuser"
}
}
Creates /opt/my-s3-bucket-folder
directory with all s3://artifact-deployer-test
bucket contents in it
If you want to sync a bucket with a local folder
"artifacts": {
"my-s3-zip": {
"enabled": true,
"s3_bucket" : "artifact-deployer-test",
"s3_filename" : "keep-calm-and-daje-forte.png.zip",
"destination": "/opt",
"owner": "myuser"
}
}
Downloads keep-calm-and-daje-forte.png.zip
from s3://artifact-deployer-test
bucket and copies as /opt/my-s3-zip.zip
You can specify AWS key and secret defining awscli
databag item, as follows:
{
"id" : "my-credentials",
"aws_access_key_id" : "AKI*****************",
"aws_secret_access_key" : "****************************************"
}
Check test awscli databags for more samples.
Unpacking and filtering
"artifacts": {
"solr-home": {
"enabled": true,
"groupId": "org.alfresco",
"artifactId": "alfresco-solr",
"type": "zip",
"version": "5.0.a",
"destination": "/var/lib/tomcat7",
"owner": "tomcat7",
"unzip": true,
"filtering_mode" : "replace",
"properties" : {
"archive-SpacesStore/conf/solrcore.properties" : [
"alfresco.host" : "192.168.0.22",
"solr.secureComms" : "none"
],
"test.properties" : [
"my.host" : "192.168.0.22",
"filtering_mode" : "append"
]
},
"terms" : {
"context.xml" : [
"@@ALFRESCO_HOST@@" : "192.168.0.22"
]
}
}
}
Filtering can be used via terms
or properties
attributes defined within the artifact configuration; each of those contain a list of file path(String) => attributes(Map<String,String>)
, where
- file path is the path, within the unpacked ZIP file, of the file that needs to be patched
- attributes maps the original string with the new ones to be injected
When using terms
, each attribute's key is replaced with the attribute's value.
When using properties
, a file line starting with <key>=
will be searched and replaced with <key>=<value>
; if the line doesn't exist, by default nothing will happen (unless filtering_mode
is set to append
); if the file doesn't exist, it will be created.
filtering_mode
can be specified at artifact level or as an attribute of properties, as shown in the example above.
Unpacking options
Artifact name
The name of the file/folder fetched by artifact-deployer can be customised; by default it is the name of the JSON key (i.e my-amp
), but you can override it using destinationName
attribute:
"artifacts": {
"my-amp": {
"enabled": true,
"path": "my-amp/target/my-amp.amp",
"destinationName" : "my.amp"
"destination": "/var/lib/tomcat7/amps",
"owner": "tomcat7"
}
}
Including a single sub-folder
You can only include one specific subfolder of a ZIP, using the following syntax:
"artifacts": {
"keystore": {
"enabled": true,
"groupId" : "org.alfresco",
"artifactId" : "alfresco-repository",
"version" : "5.0.a",
"destination": "/var/lib/tomcat7/keystore",
"subfolder": "alfresco/keystore/\*",
"owner": "tomcat7"
}
}
Unit testing
bundle update
bundle exec rake
Integration testing
kitchen test
Dependent cookbooks
maven ~> 1.2.0 |
file >= 0.0.0 |
python >= 1.4.6 |
apt >= 2.3.10 |
ark >= 0.9.0 |
resolver >= 1.2.0 |
java >= 1.31.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.8.18 passed this metric
0.8.18 passed this metric
Contributing File Metric
0.8.18 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
0.8.18 failed this metric
Foodcritic Metric
0.8.18 passed this metric
0.8.18 passed this metric
No Binaries Metric
0.8.18 passed this metric
0.8.18 passed this metric
Testing File Metric
0.8.18 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
0.8.18 failed this metric
Version Tag Metric
0.8.18 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.8.18 failed this metric