Summary
If you are trying to move CloudBees CD (CloudBees Flow) Artifacts between repositories, depending on whether the two repositories are within a network or not, these are the following steps to move artifacts from one repository to another.
Solution
Scenario 1: Repositories are in-network
If the two repositories are in-network, then you can simply copy the directory structure over from one repository to another and then delete it in the source repository (if moving artifacts). Renaming artifacts during this move will not update metadata in the Commander Database and makes them unretrievable.
Scenario 2: Repositories are in separate network or If a renaming is required
You can retrieve artifact from source repository and publish to destination repository. You will use these methods if you want to rename the artifact for any reason.
Method 1 : UI
-
Create a procedure within the project to retrieve and publish artifact to a new repository.
-
Create a step named 'Retrieve Artifact Version'. Utilize the sub procedure EC-Artifact : Retrieve.
-
If necessary, Retrieve Artifact Version to a temp Directory.
-
-
Create a step named 'Publish Artifact Version'. Utilize the sub procedure EC-artifact : Publish. To change repositories of the publish artifact, you must change the Repository field within the Publish Artifact step.
-
If previously retrieved directory to a temp directory, provide file path to the From Directory field.
-
Method 2 : ectool
Use ectool to retrieve and publish ArtifactVersion. You would use the following commands to retrieve and publish the artifacts.
ectool retrieveArtifactVersions --artifactName --versionRange ectool publishArtifactVersion --artifactName --version --repositoryName
Method 3: Ec-perl
To use EC-perl, you would define either a new Step or File with the following code:
#!/usr/bin/perl use strict; use ElectricCommander; $| = 1; my $cmdr = new ElectricCommander(); my $artifact = $cmdr->retrieveArtifactVersions({cacheDirectory => "Cache File path if required", artifactName => "Artifact Name", versionRange => "Version Range", toDirectory => "Temp Directory", }); $cmdr->publishArtifactVersion({artifactName => "Artifact Name", version => "Version Number", repositoryName => "repositoryName", fromDirectory => "Temp Directory", });