Jfrog artifactory cli - jfrog-cli

you I am trying to pass two ${key} values in a file spec. Is there any way I can call these two ${key} values through jfrog cli command?
E.g., I have tried the following command
sh "./jfrog rt s --spec compare.spec --spec-vars currentBuild=${currentBuild.number};previousBuild=${currentBuild.previousBuild.number}"
But it is displaying output only for one value.

The command is missing quotes surrounding the spec-vars. So for example with a spec file like
{
"files": [
{
"pattern": "${pat}/",
"target": "${tgt}/"
}
]
}
I need to run the command as
jfrog rt dl --spec otherspec --spec-vars "pat=generic-local;tgt=local"
To make sure that I download the files from the "generic-local" repository to a folder called "local"
If you execute the command with JFROG_CLI_LOG_LEVEL=DEBUG, the output will display both the spec file you provided as well as the resolved file:
$ JFROG_CLI_LOG_LEVEL=DEBUG jfrog rt dl --spec otherspec --spec-vars "pat=generic-local;tgt=local"
[Debug] Replacing variables in the provided File Spec:
{
"files": [
{
"pattern": "${pat}/",
"target": "${tgt}/"
}
]
}
[Debug] Replacing '${pat}' with 'generic-local'
[Debug] Replacing '${tgt}' with 'local'
[Debug] The reformatted File Spec is:
{
"files": [
{
"pattern": "generic-local/",
"target": "local/"
}
]
}
[Info] Searching items to download...

Related

How to upload multiple seperate folders and thier contents to a single zip file to JFrog Artifactory using "jf rt upload". ( /Alpha, /Beta, /Gamma)

Given the following folder structure:"/Alpha,/Beta,/Gamma,/Delta, ..."
Using JFrog CLI how can I upload only the first two folders and thier entire contents.
Ive tried the following using a regular expression:
jf rt upload "Alpha|Beta" My-generic-local/My-rep-folder/target.zip --archive zip --dry-run --regexp
[Error]CreateFile Aplha|Beta: The filename, directory name, or volume label syntax is incorrect.
You can try File Specs for this purpose.
jf rt upload --spec=filespec.json
filespec.json:
{
"files": [
{
"pattern": "Alpha/",
"target": "My-generic-local/My-rep-folder/target.zip",
"archive": "zip"
},
{
"pattern": "Beta/",
"target": "My-generic-local/My-rep-folder/target.zip",
"archive": "zip"
}
]
}
Learn more about JFrog File Specs:
JFrog File Specs
Using File Specs in JFrog CLI

Testing Cypress with Browserstack does not work: "Malformed Archive"

I am trying to get a Cypress example test running in Browserstack. I am following this tutorial: Run your Cypress tests
However when it comes to running browserstack-cypress run im getting the following output:
[2020-12-4 17:00:12] - info: Reading config from /home/dennis/Repos/CMS/browserstack.json
[2020-12-4 17:00:12] - info: Reading username from the environment variable BROWSERSTACK_USERNAME
[2020-12-4 17:00:12] - info: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
[2020-12-4 17:00:12] - info: browserstack.json file is validated
[2020-12-4 17:00:46] - error: Malformed archive
[2020-12-4 17:00:46] - error: Zip Upload failed.
[2020-12-4 17:00:46] - info: Zip file deleted successfully.
This is what my browserstack.json looks like:
{
"auth": {
"username": "<user name>",
"access_key": "<access key>"
},
"browsers": [
{
"browser": "chrome",
"os": "Windows 10",
"versions": [
"latest",
"latest-1"
]
}
],
"run_settings": {
"cypress_config_file": "./cypress.json",
"project_name": "<project name>",
"build_name": "",
"parallels": "10",
"npm_dependencies": {},
"package_config_options": {}
},
"connection_settings": {
"local": false,
"local_identifier": null
},
"disable_usage_reporting": false
}
The cypress.json file is empty:
{}
What I'm also not getting is where I am defining what tests I want to run and where they are located.
I appreciate any help! Thanks!
I've come across the "Malformed archive" error when the runner tries to compress the entire project and tries to upload it instead of just the Cypress Test files.
You should be able to fix this by moving the Cypress test files into a subfolder:
test
|
| cypress.json
| Browserstack.json
| cypress
|
| fixtures
| integration
| support
| plugins
Set the path to cypress.json in browserstack.json
Refer: https://www.browserstack.com/docs/automate/cypress/sample-tutorial

How to untar a file second time using file spec explode:true on a Jenkins job

I'm using file spec below in a Jenkins job to download artifact and untar the artifact. It untar it but that tar has 2 other tar files and I need to untar those 2 files as well. How can I do that using explode:true the second time?
{
"files": [
{
"pattern": "sys /${RELEASE}/${BUILD_NUMBER}/samples*.tar.gz",
"target": "${PATH}",
"explode": true,
"target": " server.tar.gz",
"explode": true
}
]

Upload Image on TryStack Server using Packer tool

I am trying to create and upload an ubuntu based image on trystack server using packer tool. I am using Windows OS to do it. I have created a sample template and loads a script file for setting environment variables using chef. But when I am running the packer build command I get
1 error(s) occurred:
* Get /: unsupported protocol scheme ""
What am I missing in this ??
Here are the template and script files
template.json
{
"builders": [
{
"type": "openstack",
"ssh_username": "root",
"image_name": "sensor-cloud",
"source_image": "66a14661-2dfb-4370-b6d4-87aaefcffdce",
"flavor": "3",
"availability_zone": "nova",
"security_groups": ["mySecurityGroup"]
}
],
"provisioners": [
{
"type": "file",
"source": "sensorCloudCookbook.zip",
"destination": "/tmp/sensorCloudCookbook.zip"
},
{
"type": "shell",
"inline": [
"curl -L https://www.opscode.com/chef/install.sh | bash"
],
"execute_command": "chmod +x {{ .Path }}; sudo -E {{ .Path }}"
},
{
"type": "shell",
"inline": [
"unzip /tmp/sensorCloudCookbook.zip -d /tmp/sensorCloudCookbook"
],
"execute_command": "chmod +x {{ .Path }}; sudo -E {{ .Path }}"
},
{
"type": "shell",
"inline": [
"chef-solo -c /tmp/sensorCloudCookbook/solo.rb -l info -L /tmp/sensorCloudLogs.txt"
],
"execute_command": "chmod +x {{ .Path }}; sudo -E {{ .Path }}"
}
]
}
openstack-config.sh
#!/bin/bash
# To use an OpenStack cloud you need to authenticate against the Identity
# service named keystone, which returns a **Token** and **Service Catalog**.
# The catalog contains the endpoints for all services the user/tenant has
# access to - such as Compute, Image Service, Identity, Object Storage, Block
# Storage, and Networking (code-named nova, glance, keystone, swift,
# cinder, and neutron).
#
# *NOTE*: Using the 2.0 *Identity API* does not necessarily mean any other
# OpenStack API is version 2.0. For example, your cloud provider may implement
# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is
# only for the Identity API served through keystone.
export OS_AUTH_URL=http://128.136.179.2:5000/v2.0
# With the addition of Keystone we have standardized on the term **tenant**
# as the entity that owns the resources.
export OS_TENANT_ID=trystack_tenant_id
export OS_TENANT_NAME="trystack_tenant_name"
export OS_PROJECT_NAME="trystack_project_name"
# In addition to the owning entity (tenant), OpenStack stores the entity
# performing the action as the **user**.
export OS_USERNAME="same_as_trystack_tenant_name"
# With Keystone you pass the keystone password.
echo "Please enter your OpenStack Password: "
read -sr OS_PASSWORD_INPUT
export OS_PASSWORD=$OS_PASSWORD_INPUT
# If your configuration has multiple regions, we set that information here.
# OS_REGION_NAME is optional and only valid in certain environments.
export OS_REGION_NAME="RegionOne"
# Don't leave a blank variable, unset it if it was empty
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
You need to source openstack-config.sh before packer build.

Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source

I get the following error when running vagrant up --provision to set up my development environment with vagrant...
==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af) does not match checksum on content (12f75e)
My chef JSON has the following for nginx:
"nginx": {
"version": "1.7.8",
"user": "deploy",
"init_style": "init",
"modules": [
"http_stub_status_module",
"http_ssl_module",
"http_gzip_static_module"
],
"passenger": {
"version": "4.0.53",
"gem_binary": "/home/vagrant/.rbenv/shims/gem"
},
"configure_flags": [
"--add-module=/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/passenger-3.0.18/ext/nginx"
],
"gzip_types": [
"text/plain",
"text/html",
"text/css",
"text/xml",
"text/javascript",
"application/json",
"application/x-javascript",
"application/xml",
"application/xml+rss"
]}
and Cheffile has the following cookbook:
cookbook 'nginx'
How do I resolve the Checksum mismatch?
The nginx cookbook requires you to edit the checksum attribute when using another version of nginx. The remote_file resource that is causing you an error is:
remote_file nginx_url do
source nginx_url
checksum node['nginx']['source']['checksum']
path src_filepath
backup false
end
You need to update the checksum value. Specifically node['nginx']['source']['checksum'].
So in your JSON, you would add this line:
"source": {"checksum": "insert checksum here" }
Edit: As pointed out in the comments, the checksum is SHA256. You can generate the checksum of the file like so:
shasum -a 256 nginx-1.7.8.tar.gz

Resources