Bulk import your RPM packages to Cloudsmith using a script. There are a few prerequisites that need to be set up prior to importing the packages in order for the script to work, and this can be changed to automate according to your setup.
- Install Cloudsmith CLI
- Create a folder to place the script and content into
- Create a folder with exactly the same name as your repository name in Cloudsmith
- Inside the created (repo) folder, create a distro folder you wish to upload, for a list of available distros, you can run
cloudsmith list distros rpmand use the right side of the table as name for the folder. PLEASE NOTE that since the distro/release includes a slash, please create a folder replacing it with a dot (
For example, if your distro is
el/any-version, the folder should be named
el.any-version. In full context:
Example folder structure:
rpm_import/ ├─ config.ini ├─ credentials.ini ├─ rpm_import.sh ├─ repo_name_1/ │ ├─ any-distro.any-version/ │ │ ├─ some_package.rpm ├─ repo_name_2/ │ ├─ el.7/ │ │ ├─ some_package.rpm
- Inside the folder insert all the
.rpmfiles that will belong to that repository and distro/release.
Finally, you can run the script below to start uploading files to the selected repository by running
# Check if cloudsmith creds exist, if not run cloudsmith login if [ ! -f config.ini ]; then echo "config.ini not found, running cloudsmith login" cloudsmith login fi # set org name and repo read -p "Enter the repo name: " repo_name read -p "Enter the organisation name: " org_name # get all folder names in repo_name and save to variable as release names release_names=$(ls $repo_name) # loop through release names and upload to cloudsmith for release in $release_names; do # create a new veriable for release name and replace dot with slash release_name=$(echo $release | sed 's/\./\//g') # get all .rpm files in release and upload to cloudsmith for rpm in $(ls $repo_name/$release/*.rpm); do cloudsmith push rpm $org_name/$repo_name/$release_name $rpm --no-wait-for-sync done done
Updated about 2 months ago