How to move artifacts in artifactory? - artifactory

Can someone help me find a way to copy an artifact from one artifactory location to another location, inside the same repository. I understand there are ways to move artifactory between repositories, but my requirement is to move x1 to module-2 as in below folder structure.
+
+- repository
+- com
+- module-1
| +- x1
+- module-2
+- x2
Thank you very much in advance.

The easiest way is using the REST API. Here's an example:
curl -v -X -d "" POST -uusername "http://host:port/artifactory/api/move/repository/com/module-1/x1?to=/repository/com/module2/x1"

You can also use the JFrog CLI. The usage is something like
jfrog rt move repository/com/module-1/x1 repository/com/module2/x1
The cli is especially useful when you want to move multiple files.

Related

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

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}

Why changing LD_LIBRARY_PATH has no effect in Ubuntu?

I was trying to deploy my application on Ubuntu 16.04. So i made a package with the following hierarchy -
Package
|
----bin
|
-----application
-----application.sh
-----Qt
|
-----necessary qt libraries
-----platforms
Here is the application.sh file -
#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/Qt
./application
When i execute the application.sh file, it shows me that it cant find the libQt5MultimediaWidgets.so.5 file. But its in the Qt folder. Also when i print the ldd application from the application.sh file after exporting LD_LIBRARY_PATH it gives me following output -
Please check the marked parts. Can anyone please explain why the libraries from the Qt folder are not found even after exporting the LD_LIBARRY_PATH?
Edit:
So as suggested by #Zang, i have checked the debug log and here it is -
Please check the marked parts.
It seems like its actually trying the actual libQt5MultimediaWidgets.so and then report that its unable to find it. Can anyone please help me understand whats happening here?
Edit-2: As per suggestion from #Tarun, i have ran ls -al on my Qt folder. Here is the output -
All files in Your Qt directory are actually simlinks to non-existing files in the same directory, therefore they cannot be found.
If you look at the output of your ls -al
These are soft links that you have. Your softlink libQt5MultimediaWidgets.so.5 points to libQt5MultimediaWidgets.so.5.9.2 in the same directory and the file is not there at all. So you need to either set the correct softlink path or have the file in same directory
First
Could it be that the pwd is not where you assume it is?
You could try adding
# Figure out where the application.sh script is located
scriptpath="$( cd "$(dirname "$0")" ; pwd -P )"
# Make sure our pwd is that location
cd "$scriptpath"
in the top of your script (assumes bash shell, from here)
By doing this all relative paths to Qt folder will be valid.
Second
Maybe you should considder exporting your new LD_LIBRARY_PATH, like so (from here):
LD_LIBRARY_PATH=whatever
export LD_LIBRARY_PATH
Third
It may be useful to run ldconfig command for ld to update after changing the variable (from here):
sudo ldconfig
The file libQt5MultimediaWidgets.so is not present in /Desktop/package/bin/Qt according to the screenshots shown.

How to check if core files have changed

I am working on a project in Bootstrap 4. I suspect that core file have been disturbed/changed by other developers and want to prove if i am right or wrong. How can i compare to both, as it is a huge framework.
I assume your Bootstrap core files are in dir1/ and you are on linux (or have access to a terminal, i.e. git shell).
Download the Bootstrap4 core files again into dir2/ next to dir1
Navigate to the parent directory of dir1 and dir2 in your terminal
run a diff i.e.: $ diff -r dir1/ dir2/
Check the output for differences
Yes, you can if you are using version control software (git?). If you don't use it it might be hard to show that change.
To expand on Andreas's answer, you can diff in a number of ways.
$ Diff
Most popular is likely shell/terminal diff as mentioned in Andrea's answer.
GitHub
You could also use version control tools, upload each as a branch, and see the diff in GitHub.
Software
There's also a number of installable software. I often use BeyondCompare to compare directories of photos to see if they've been edited.

With SBT, how do I a specify an alternate project root other than the current directory for running a main class?

Normally SBT looks for the build files at ./build.sbt and ./project/Build.scala. Is it possible to specify an alternate project root, so I can build a project not in the current working directory? I'm looking essentially for an equivalent to mvn -f /path/to/pom.xml but the docs have not provided me with any obvious answers.
(I should note that I want to do this at runtime rather than compile time. Essentially, I want to use sbt run-main to run arbitrary classes from my project, since I hate manual classpath wrangling. For various boring reasons I may need to do this from arbitrary location since the code may need the working directory to be something other than the project directory, so using cd might not do what I want. It's so trivial in Maven - I just assumed, perhaps unfairly, that there would be a simple equivalent in SBT)
I have something like this. I have project definition at X/build.sbt, X/MyOtherDefinitionWithSpecialThing/build.sbt, X/MySuperPublishConfig/build.sbt.
But my point of view to the problem is opposite. Instead of specify location of ./build.sbt and ./project/Build.scala I specify location of path to resources. The result is the same. It looks like:
sourceDirectory <<= (baseDirectory) (_ / ".." / "src")
target <<= (baseDirectory) (_ / ".." / "target")
This is allow to create single project with multiple definitions. This is worked with nested/hierarchical projects. But I use symbolic links (Linux OS) for hierarchical projects.
There is a file tree of one of my SBT plugins. Multiple build definitions and only one src/...
.
|-build.sbt
|-project
|---project
|-----target
|-------...
|---target
|-----...
|-project-0.11
|---build.sbt
|---project
|-----project
|-------target
|---------...
|-----target
|-------...
|-project-0.12
|---build.sbt
|---project
|-----project
|-------target
|---------...
|-----target
|-------...
|-...
|-src
|---main
|-----scala
|-------org
|---------...
|---sbt-test
|-----...
|-target
|---...
If this not solution of your problem please elaborate why you don't want use 'cd' command ;-)
-- For the updated use case:
I use shell wrapper and I have symlink to this one in every SBT project:
#!/bin/sh
#
here=$(cd $(dirname "$0"); pwd)
if [ ! -e "${here}/build.sbt" ]
then
echo build.sbt lost
exit
fi
cd ${here}
LOCAL_BUILD=true sbt-0.12 "$#"
I simply write /path/to/my/project/sbt 'show name' for example or /path/to/my/project/sbt run-main in your case.
As I discovered from this other answer, the sbt-start-script plugin is a better tool for this than sbt run-main. You can simply run sbt stage and you get an invocation script, with classpaths resolved, at target/start. According to the documentation, it needs to be run from the build root directory for inter-project dependencies to work, but for my simple use cases, this doesn't seem to be a problem.

directory hash instead of the original path

This is how I store my projects on the server dev.anuary.com/mike-gamaroff/2011 10 04 unbreakable-embrace/, i.e. server + client name + project data and name.
The problem is, that some clients started to complain about their names appearing in the URL, when it is visible. Is there a way to get to the URL path using some sort of hash of the original directory path?
That dev.anuary.com/mike-gamaroff/2011 10 04 unbreakable-embrace/ would become dev.anuary.com/2989dh42[whatever]098dfsdfsf/, though, I could still keep the original directory tree?
Create symbolic links on the server?
PROJECT_NAME="$server/$clientName/$projectData $name/"
ln -s /var/www/vhosts/dev.anuary.com/htdocs/$server/$projectData\ $name /var/www/vhosts/dev.anuary.com/htdocs/mike-gamaroff/`echo $PROJECT_NAME | md5sum`
Just a quick guess ...
Then, the site would be available via the normal URL you are speaking about, or via the md5sum URL.
If you want to have this enabled for all projects, you'll need to either manually create them, or do some fun recursion with a shell script down through all the various directories. The benefit to doing this is that you can update a master file that provides a proper reference between project name and hash .. for quick reference
for dir in $(find ./ -type d); do
# do some fancy symbolic linking if the criteria is right
done

Resources