aboutsummaryrefslogtreecommitdiffstats
path: root/docker/scripts/set_dockerfile_and_pom.pl
diff options
context:
space:
mode:
Diffstat (limited to 'docker/scripts/set_dockerfile_and_pom.pl')
-rw-r--r--docker/scripts/set_dockerfile_and_pom.pl62
1 files changed, 62 insertions, 0 deletions
diff --git a/docker/scripts/set_dockerfile_and_pom.pl b/docker/scripts/set_dockerfile_and_pom.pl
new file mode 100644
index 0000000..8411f30
--- /dev/null
+++ b/docker/scripts/set_dockerfile_and_pom.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+
+my @lines;
+
+#
+### POM file
+#
+
+my $file = 'pom.xml';
+### Read the pom.xml file.
+open (POM, $file) or die "[ERROR] Cannot read the file '$file' : $!\n\n";
+chomp (@lines = <POM>);
+close (POM);
+
+open (NEW, ">${file}") or die "[ERROR] Cannot write to the file '$file' : $!\n\n";
+foreach my $line (@lines) {
+
+ # Replace groupID
+ if ($line =~ m|<groupId>org.onap.sdc</groupId>|) {
+ $line =~ s|org.onap.sdc|com.att.sdc|;
+ }
+
+ # Remove the tags.
+ if ($line =~ m|<tag>(.*)</tag>|) {
+
+ if ($1 eq '${docker.tag}') {
+ $line =~ s|\$\{docker.tag\}|\$\{project.version\}|;
+ }
+ else {
+ next;
+ }
+ }
+
+ print NEW "$line\n";
+}
+close (NEW);
+
+
+#
+### Dockerfie
+#
+
+my $dockerFile = 'Dockerfile';
+
+open (FILE, $dockerFile) or die "[ERROR] Cannot read the file '$dockerFile' : $!\n\n";
+chomp (@lines = <FILE>);
+close (FILE);
+
+open (NEW, ">${dockerFile}") or die "[ERROR] Cannot write to the file '$dockerFile' : $!\n\n";
+
+foreach my $line (@lines) {
+ # Replace the docker registry
+ if ($line =~ m|FROM|) {
+ $line =~ s|onap|dockercentral.it.att.com:5100/com.att.sdc|;
+ }
+ print NEW "$line\n";
+}
+close (NEW);