2 # ============LICENSE_START====================================================
3 # =============================================================================
4 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
5 # =============================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END======================================================
23 my $browser = LWP::UserAgent->new;
24 if(defined $ENV{'HTTPS_PROXY'}) {
25 $browser->proxy('https', $ENV{'HTTPS_PROXY'});
27 elsif(defined $ENV{'http_proxy'}) {
28 $browser->proxy('https', $ENV{'https_proxy'});
33 #############################################################################################
34 # Usage: createStagingOverride.yaml staging-image-override.yaml
35 # generates staging-image-orveride.yaml.out which can be used as a -f override file
37 # script queries nexus3 docker.snapshot repository for the image tags
38 # query is only for lines with "onap/" in the override.yaml file
39 # ignores 2019/2010, v* tagged images to try to find the latest version numbered SNAPSHOT/STAGING:latest
41 #############################################################################################
43 $outfile=">" . $infile . ".out";
47 open (INFILE, $infile) or die "couldnt open INFILE $infile\n";
48 open(OUTOVER,$outfile) or die "couldnt open OUTOVER $outfile\n";
50 while ($line=<INFILE>) {
51 #image: onap/portal-app:2.6.0-STAGING-latest
52 if ($line=~/: onap\//) {
54 ($imageJunk,$imagePath,$imageVersion) = split(':', $line);
56 $imageVersion=~s/ //g;
57 $stagingImageVersion=&getVersion($imagePath,$imageVersion);
58 $stagingImageVersion=~s/ //g;
59 print "$imagePath , $imageVersion, $stagingImageVersion\n";
60 $VERSIONS{$imagePath}=$stagingImageVersion;
61 $line=~s/$imageVersion/$VERSIONS{$imagePath}/;
62 print OUTOVER $line . "\n";
73 my ($path, $version) = @_;
74 #print $path , $version , "\n";
75 my $url = "https://nexus3.onap.org:10001/v2/$path/tags/list" ;
77 my $response = $browser->get( $url );
78 die "Can't get $url -- ", $response->status_line
79 unless $response->is_success;
80 #print $response->decoded_content;
82 $response_json=decode_json $response->decoded_content;
83 #print $response_json->{'name'} , "\n";
84 $latest_tag=$response_json->{'tags'}->[0] ;
85 $tags=$response_json->{'tags'};
86 foreach my $element (@$tags) {
90 if ($element=~/2019/) {
93 if ($element=~/2020/) {
96 if ($element=~/\d\./) {
97 #print $element , "\n";
98 if($element gt $latest_tag) {