Add Nexus3 port fwrding for ARM64 06/83906/5
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Tue, 2 Apr 2019 01:05:03 +0000 (18:05 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 3 Apr 2019 17:39:18 +0000 (10:39 -0700)
ARM64 nodes need to have these Nexus3 ports
forwarded for now until we are able to move to
DockerHub.
This change is done to unblock CI/CD testing for ARM64

Change-Id: I4978f22a6c1d8e7e37972f0b2e5f9ca1d613d104
Issue-ID: CIMAN-229
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
jenkins-scripts/jenkins-init-script.sh
jenkins-scripts/nexus3_port_forwarding.sh [new file with mode: 0755]

index 67987b5..dd76d8a 100755 (executable)
@@ -25,3 +25,6 @@ fi
 # Create the jenkins user last so that hopefully we don't have to deal with
 # guard files
 ./create_jenkins_user.sh
+
+# Nexus3 port forwarding rules for ARM64
+./nexus3_port_forwarding.sh
diff --git a/jenkins-scripts/nexus3_port_forwarding.sh b/jenkins-scripts/nexus3_port_forwarding.sh
new file mode 100755 (executable)
index 0000000..31d41b2
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+echo "---> nexus3_port_forwarding.sh"
+set +e  # DON'T fail build if script fails.
+
+NEXUS3_IP=`host nexus3.onap.org | awk '/has address/ { print $4 ; exit }'`
+OS_ARCH=$(ANSIBLE_STDOUT_CALLBACK=json ANSIBLE_LOAD_CALLBACK_PLUGINS=1 \
+    ansible all -i "localhost," --connection=local -m setup | jq -r \
+    '.. | .ansible_architecture? | select(type != "null")' \
+    | tr '[:upper:]' '[:lower:]')
+
+
+if [[ "${OS_ARCH}" == "aarch64" ]] ;then
+  echo "os_arch: $OS_ARCH"
+  iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10001 -j DNAT --to-destination ${NEXUS3_IP}:11001
+  iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10002 -j DNAT --to-destination ${NEXUS3_IP}:11002
+  iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10003 -j DNAT --to-destination ${NEXUS3_IP}:11003
+fi
+
+# DON'T fail build if script fails.
+exit 0