How to Upload Multiple Artifacts to artifactory along with their folder structure using Jfrog CLI - artifactory

I need to upload all the artifacts generated as part of the build to artifactory based on its folder structure.
Here folder structure is nothing but group id, version and artifact id was mentioned at pom level in case of all the dependencies.
So the expectation is how to mention that folder structure in "jfrog rt upload" CLI command?
Because the folder structure will change for every artifact.
jfrog rt upload --flat=false "${dynamic folder structure}/*" p2-release-local/
As per our expectation artifacts should go like this,
http://<artifactorylink>/<group id>/<artifac id>/<version>/<.jar>
http://<artifactorylink>/<group id>/<artifac id>/<version>/<.pom>
NOTE: Am using freestyle job in jenkins, so i cannot use the jfrog plugin to do this for me. And the plugins which are availalbe in freestyle job also will upload some artifacts even we need to provide group and artifact id for it. so it doesn't seems to be helping.
Please let me know how to could accomplish this expectation or if there is anyother way i could upload these artifacts to JFROG along with folder structure.

If you want to upload a folder and files in it using JFrog CLI, you may visit this confluence page for the complete details.
In short, you may use the below command.
jfrog rt u "root/test/(*)" p2-release-local/test/{1}
To apply the source path pattern for directories as well as files, add the include-dirs flag.
jfrog rt u --include-dirs=true "root/test/(*)" p2-release-local/folder/{1}

Related

Download file to current directory using the JFrog CLI

When I do
jfrog rt dl a/b/c.zip
I would expect c.zip to be in the current directory, but it is written to a/b/c.zip, for whatever reason. How can I force the CLI to download it to the current directory?
The --flat option is what you are looking for.
From the documentation:
[Default: false]
If true, artifacts are downloaded to the exact target path specified
and their hierarchy in the source repository is ignored.
If false, artifacts are downloaded to the target path in the file
system while maintaining their hierarchy in the source repository.

How to upload complete folder structure to Artifactory repo to a new folder and keep he folder name as it is?

I'm new to automation and Tried uploading entire folder structure to Artifactory repo with parent folder and child folders
structure is as below
test1 folder contains sub-folder: new_ref and it also contains sub-folder>>v1, new_data1 and it also contains sub-folder>>v1, v1 and it also contains sub-folder>>bl, memo
Tried using both --flat=true and false option:
jfrog.exe rt u --flat=false "F:/main/test1/" mr-local-generic/new_data/
On Artifactory its required to create folder name "new_data" and under that it should upload below folders with their respective child folders intact: new_ref, new_data1, v1, memo
But it creates folder name as new_data/F:/main/test1/ , how to resolve this any help is much appreciated.
--flat=false keeps the system hierarchy. If you wish to upload without the path prefix, you have the following options:
Run the upload command from the directory you wish to upload from, and use relative path with --flat=false:
cd /d F:\main\test1
jfrog.exe rt u --flat=false "./" mr-local-generic/new_data/
Use Placeholders:
jfrog.exe rt u "F:/main/test1/(*)" mr-local-generic/new_data/{1}
To apply the source path pattern for directories as well as files, add the include-dirs flag.
For example:
jfrog.exe rt u --include-dirs=true "F:/main/test1/(*)" mr-local-generic/new_data/{1}

Unable to push Repo from "react-native-firebase-starter" template

I cloned this repo to start my own project
https://github.com/invertase/react-native-firebase-starter
I have made some modifications and got it setup for Firebase, however I cannot push or rename the Repository.
I ran npm run rename and renamed the directory. GitHub still seems to think I am trying to push the orginal repository as my own.
When I try to push I get:
Authentication failed. You may not have permission to access the repository or the repository may have been archived...
How can I keep this template/starter and push a copy of it as my own repository?
I have tried removing all of the inessential files from the Repo and pushing that way. I get the following error:
I expected to be able to use the starter as a starter to get a project up and running... Maybe I am missing something super obvious.
I don't see a .git folder within the root of the react-native-firebase-starter template, perhaps this is causing issues with pushing this template since git needs to know where to point to upstream.
Maybe you could try initializing the template to your personal git repository and seeing if this resolves your authentication issue:
Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files.
Initialize the local directory containing the template as a Git repository:
git init
Add the files in your new local repository. This stages them for the first commit:
git add .
Commit the files that you've staged in your local repository:
git commit -m "Initial commit"
At the top of your GitHub repository ,created in step 1, copy the remote repository URL.
Add the URL for the remote repository where your local repository will be pushed:
git remote add origin <remote_repository_url>
Push the changes in your local repository to your upstream repository contained in GitHub:
git push -u origin master
You should now be able to push this starter template into your own GitHub repository and use it as your own project.
As for the npm run rename command: this is a custom npm run script created by the author of this starter template and it simply runs the rename.js file contained within the .bin directory of the template's root directory. All this command does is recursively rename the files contained within this template project to the new name specified by your input, so I don't think this is causing the issue. I suspect once your project has been initialized properly with git the authentication issue will disappear as it will now point upstream to your personal repository.
Hopefully that helps!

Artifactory cli - download existing files

I'm using a JFROG cli to download content from an Artifactory. It seems that even though a destination contains same files, cli is trying to download it. If I re-run the command without cleaning the destination folder, I takes the same time.
Is there any option to speedup the process? If destination folder has the same SHA1 file, skip?
Our command (download all folders a* in the repo):
jfrog rt dl --threads=`nproc` repo_name/a*/ $TMP_FOLDER/
JFrog CLI is already skipping download in case of a file existence which is validated using a checksum.
You can see this by setting the environment variable "JFROG_CLI_LOG_LEVEL=DEBUG" and then running same download command again. In the debug log you will see on some files the following line: "File already exists locally" - this means the download was skipped due to a file existence.
The relevant code can be found in GitHub - see the method "downloadFileIfNeeded".
Keep in mind that the CLI still has to get the file info from Artifactory and calculate the local file checksum, so in case of a lot of small files, this won't have a strong effect as on big files download.

Configure cloud-controller.xml in Stratos

I have configure the cloud-controller.xml file before I start the stratos server in order to support OpenStack. The order of file given to me was stratos-server/repository/conf/cloud-controller.xml.
But, there is no folder called stratos-server, but there are about 12 files in different folders. Can anyone help me to figure out which file I have to configure and how?
I'm assuming you're using Apache Stratos 4.0.0, which earlier was WSO2 Stratos.
If you're using stratos-installer[1], then you only need to provide the OpenStack details in INSTALL_DIR/stratos-installer/conf/setup.conf file. The installer will configure cloud-controller.xml along with the other files using the information given in the setup.conf file.
However, if you're just extracting the Stratos zip file and configuring the files, the the cloud-controller.xml is in EXTRACTED_LOCATION/repository/conf/ folder.
[1] - https://cwiki.apache.org/confluence/display/STRATOS/4.0.0+Automated+Product+Configuration

Resources