1
1
package org .jfrog .build .extractor .docker .extractor ;
2
2
3
- import com .google .common .collect .ArrayListMultimap ;
3
+ import org .apache .commons .collections4 .MultiValuedMap ;
4
+ import org .apache .commons .collections4 .multimap .ArrayListValuedHashMap ;
4
5
import org .apache .commons .lang3 .StringUtils ;
5
6
import org .apache .commons .lang3 .exception .ExceptionUtils ;
7
+ import org .jfrog .build .api .util .Log ;
6
8
import org .jfrog .build .extractor .ci .BuildInfo ;
7
9
import org .jfrog .build .extractor .ci .Module ;
8
- import org .jfrog .build .api .util .Log ;
9
10
import org .jfrog .build .extractor .clientConfiguration .ArtifactoryClientConfiguration ;
10
11
import org .jfrog .build .extractor .clientConfiguration .ArtifactoryManagerBuilder ;
11
12
import org .jfrog .build .extractor .clientConfiguration .client .artifactory .ArtifactoryManager ;
21
22
import static org .jfrog .build .extractor .packageManager .PackageManagerUtils .createArtifactoryClientConfiguration ;
22
23
23
24
public class DockerPush extends DockerCommand {
24
- private final ArrayListMultimap <String , String > artifactProperties ;
25
+ private final MultiValuedMap <String , String > artifactProperties ;
25
26
26
27
27
28
/**
@@ -36,7 +37,7 @@ public class DockerPush extends DockerCommand {
36
37
* @param env - Environment variables to use during docker push execution.
37
38
*/
38
39
public DockerPush (ArtifactoryManagerBuilder artifactoryManagerBuilder ,
39
- String imageTag , String host , ArrayListMultimap <String , String > artifactProperties , String targetRepository , String username ,
40
+ String imageTag , String host , MultiValuedMap <String , String > artifactProperties , String targetRepository , String username ,
40
41
String password , Log logger , Map <String , String > env ) {
41
42
super (artifactoryManagerBuilder , imageTag , host , targetRepository , username , password , logger , env );
42
43
this .artifactProperties = artifactProperties ;
@@ -58,7 +59,7 @@ public static void main(String[] ignored) {
58
59
DockerPush dockerPush = new DockerPush (artifactoryManagerBuilder ,
59
60
dockerHandler .getImageTag (),
60
61
dockerHandler .getHost (),
61
- ArrayListMultimap . create (clientConfiguration .publisher .getMatrixParams (). asMultimap ()),
62
+ new ArrayListValuedHashMap <> (clientConfiguration .publisher .getMatrixParams ()),
62
63
clientConfiguration .publisher .getRepoKey (),
63
64
clientConfiguration .publisher .getUsername (),
64
65
clientConfiguration .publisher .getPassword (),
@@ -85,7 +86,7 @@ public BuildInfo execute() {
85
86
String imageId = DockerJavaWrapper .getImageIdFromTag (imageTag , host , env , logger );
86
87
DockerImage image = new DockerImage (imageId , imageTag , "" , targetRepository , artifactoryManagerBuilder , "" , "" );
87
88
Module module = image .generateBuildInfoModule (logger , DockerUtils .CommandType .Push );
88
- if (module .getArtifacts () == null || module .getArtifacts ().size () == 0 ) {
89
+ if (module .getArtifacts () == null || module .getArtifacts ().isEmpty () ) {
89
90
logger .warn ("Could not find docker image: " + imageTag + " in Artifactory." );
90
91
} else {
91
92
setImageLayersProps (image .getLayers (), artifactProperties , artifactoryManagerBuilder );
@@ -104,7 +105,7 @@ public BuildInfo execute() {
104
105
/**
105
106
* Update each layer's properties with artifactProperties.
106
107
*/
107
- private void setImageLayersProps (DockerLayers layers , ArrayListMultimap <String , String > artifactProperties , ArtifactoryManagerBuilder artifactoryManagerBuilder ) throws IOException {
108
+ private void setImageLayersProps (DockerLayers layers , MultiValuedMap <String , String > artifactProperties , ArtifactoryManagerBuilder artifactoryManagerBuilder ) throws IOException {
108
109
if (layers == null ) {
109
110
return ;
110
111
}
0 commit comments