Windows
It is NOT possible to mount Artifactory repositories as network drives in Windows due to unsupported commands, more information at https://www.jfrog.com/confluence/display/RTF/Using+WebDAV
However you can utilise for example https://cyberduck.io/ opensource for working with files in Artifactory repositories.
Linux
Obtain service account credentials and repository URL
Either ask your project administrators to provide you with service account credentials or set it as described at Project Detail#ServiceAccount
Details and credentials in this example are:
Repo URL: https://artifactory.shared.tds.CUSTOMERX.COM/artifactory/myrepoxxxname/ username: srv123abc password: SomEv3ryNic€PassWORD:) mount point: /MyRepoMountPoint script and service name: myreporemount
Create mount point
mkdir -p /MyRepoMountPoint chown srv123abc:srv123abc -R /MyRepoMountPoint/
Install webdav module
CentOS
yum install davfs2 -y
Ubuntu
apt-get install davfs2 -y #Answer NO to unprivileged mouting of webdav mount points
(CONDITIONAL) disable proxies for webdav
In case you are working in environment with network proxies required to access internet, you might need to disable proxies for davfs.
Simply add following at the end of /etc/davfs2/davfs2.conf file:
use_proxy 0
Add service account into secrets file
Edit /etc/davfs2/secrets file:
https://artifactory.shared.tds.CUSTOMERX.COM/artifactory/myrepoxxxname/ "srv123abc" "SomEv3ryNic€PassWORD:)"
Add mount point in fstab
Edit /etc/fstab file
#https://artifactory.shared.tds.CUSTOMERX.COM/artifactory/myrepoxxxname/ /MyRepoMountPoint davfs user,auto,_netdev,nosuid,file_mode=664,dir_mode=775,gid=users,uid=srv123abc 0 0 https://artifactory.shared.tds.CUSTOMERX.COM/artifactory/myrepoxxxname/ /MyRepoMountPoint davfs user,auto,_netdev,nosuid,file_mode=664,dir_mode=775,gid=srv123abc,uid=srv123abc 0 0
Mount prepared mountpoint
mount -av
Response should be like:
#root@jenkinsdev:~# mount -av #/ : ignored #/MyRepoMountPoint: successfully mounted
Create following re-mount script and service for automatic start
MOUNT_POINT=/MyRepoMountPoint; echo "set -ex; mount -a; ls -la $MOUNT_POINT; touch $MOUNT_POINT/tst; sleep 10; rm -f $MOUNT_POINT/tst; ls -la $MOUNT_POINT" > /usr/local/bin/myreporemount chmod +x /usr/local/bin/myreporemount myreporemount echo "[Unit] Description=Refresh of Artifactory repository repo mount point Wants=network-online.target After=network-online.target [Service] Type=oneshot ExecStart=-/usr/local/bin/myreporemount [Install] WantedBy=multi-user.target" > /etc/systemd/system/myreporemount.service systemctl enable myreporemount systemctl restart myreporemount systemctl status myreporemount
What does it do:
- creates mounting script
- creates service unit to autostart/automount after reboot
- starts synchronisation by creating some file, waiting few moments and removing that file
Inspired by: