From b3c4fefa00bb18fe2d8ae6f4ba3e2bf0abd154c5 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 7 Aug 2018 20:27:59 -0400 Subject: [PATCH] Add pre-build step to prep vm before build This new build step will run before any jobs run to prep the builder. This change should not force using of $HOME/.local/bin just yet but preps the macros in place for us to activate it in jobs later. The current virtualenv method should override what's done here. Change-Id: I55947020e2f0cdbb61f9d4e7e88927d9bc304d17 Signed-off-by: Thanh Ha --- docs/jjb/lf-macros.rst | 5 +++++ jjb/lf-macros.yaml | 9 ++++++++- shell/cmake-stage.sh | 2 +- shell/deploy-maven-file.sh | 2 +- shell/jenkins-configure-clouds.sh | 2 +- shell/jenkins-configure-global-vars.sh | 2 +- shell/logs-deploy.sh | 2 +- shell/maven-deploy.sh | 2 +- shell/maven-javadoc-publish.sh | 2 +- shell/maven-stage.sh | 2 +- shell/python-tools-install.sh | 24 ++++++++++++++++++++++++ 11 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 shell/python-tools-install.sh diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 58ec7930..a57fac5c 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -95,6 +95,11 @@ lf-infra-gpg-verify-git-signature Verify gpg signature of the latest commit message in $WORKSPACE. This command assumes that $WORKSPACE is a git repo. +lf-infra-pre-build +------------------ + +Macro that runs before all builders to prepare the system for job use. + lf-infra-package-listing ------------------------ diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 16cd33c6..5188417a 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -48,6 +48,11 @@ builders: - shell: !include-raw: ../shell/gpg-verify-git-signature.sh +- builder: + name: lf-infra-pre-build + builders: + - shell: !include-raw-escape: ../shell/python-tools-install.sh + - builder: name: lf-infra-ship-logs builders: @@ -58,7 +63,9 @@ - lf-infra-create-netrc: server-id: logs - shell: !include-raw: - - ../shell/lftools-install.sh + # Ensure python-tools are installed in case job template does not + # call the lf-infra-pre-build macro. + - ../shell/python-tools-install.sh - ../shell/logs-deploy.sh - shell: !include-raw: - ../shell/logs-clear-credentials.sh diff --git a/shell/cmake-stage.sh b/shell/cmake-stage.sh index 5b67edc3..b91d6e1e 100644 --- a/shell/cmake-stage.sh +++ b/shell/cmake-stage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2018 The Linux Foundation and others. diff --git a/shell/deploy-maven-file.sh b/shell/deploy-maven-file.sh index 1b895389..e5bf0500 100644 --- a/shell/deploy-maven-file.sh +++ b/shell/deploy-maven-file.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. diff --git a/shell/jenkins-configure-clouds.sh b/shell/jenkins-configure-clouds.sh index 47023f7d..070a94e7 100644 --- a/shell/jenkins-configure-clouds.sh +++ b/shell/jenkins-configure-clouds.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2018 The Linux Foundation and others. diff --git a/shell/jenkins-configure-global-vars.sh b/shell/jenkins-configure-global-vars.sh index af36d100..de45f907 100644 --- a/shell/jenkins-configure-global-vars.sh +++ b/shell/jenkins-configure-global-vars.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2018 The Linux Foundation and others. diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index 7b656930..114692e9 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. diff --git a/shell/maven-deploy.sh b/shell/maven-deploy.sh index 0ab5c6c4..38c2f7dd 100644 --- a/shell/maven-deploy.sh +++ b/shell/maven-deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. diff --git a/shell/maven-javadoc-publish.sh b/shell/maven-javadoc-publish.sh index fa691e60..e395a5ea 100644 --- a/shell/maven-javadoc-publish.sh +++ b/shell/maven-javadoc-publish.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. diff --git a/shell/maven-stage.sh b/shell/maven-stage.sh index a525c2cb..bcac7f65 100644 --- a/shell/maven-stage.sh +++ b/shell/maven-stage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. diff --git a/shell/python-tools-install.sh b/shell/python-tools-install.sh new file mode 100644 index 00000000..5866ea5c --- /dev/null +++ b/shell/python-tools-install.sh @@ -0,0 +1,24 @@ +#!/bin/bash -l +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +set -eux -o pipefail + +REQUIREMENTS_FILE=$(mktemp /tmp/requirements-XXXX.txt) + +cat << EOF > "$REQUIREMENTS_FILE" +lftools~=0.15.0 +python-heatclient~=1.16.1 +python-openstackclient~=3.16.0 +EOF + +pip install --user --quiet --upgrade pip==18.0 setuptools==40.0.0 +pip install --user --quiet --upgrade -r "$REQUIREMENTS_FILE" +pip freeze -- 2.16.6