Align build scripts to LF 50/750/6
authorSaku Chydenius <saku.chydenius@nokia.com>
Mon, 20 May 2019 11:03:31 +0000 (14:03 +0300)
committerSaku Chydenius <saku.chydenius@nokia.com>
Thu, 23 May 2019 09:41:03 +0000 (12:41 +0300)
 - In LF we shall build docker containers on every build. Improvement to
   this process would be to separate these two docker environments from the
   build-tools repo. They could publish images to LF Nexus3 from where
   build-tools could directly utilize then.

 - There is not need to download ISO image dependencies from the Nexus3
   thus this code is removed. Now they will be downloaded directly from the
   internet with wget.

Change-Id: I8cbc89a1c25a5dedc0ce0556d00e80c09995c976
Signed-off-by: Saku Chydenius <saku.chydenius@nokia.com>
build_images.sh
build_step_create_install_cd.sh
build_step_golden_image.sh
create_rpmdata_in_docker.sh
docker-context/Dockerfile-dib
lib.sh
nexus3_dl.sh [deleted file]

index 4b1581c..bbaaf00 100755 (executable)
@@ -54,6 +54,9 @@ source $scriptdir/lib.sh
 
 _initialize_work_dirs
 
+docker build -f $scriptdir/docker-context/Dockerfile-dib -t dib $scriptdir/docker-context
+docker build -f $scriptdir/docker-context/Dockerfile-buildtools -t buildtools $scriptdir/docker-context
+
 # Create manifest RPM
 $LIBDIR/create_manifest_rpm.sh
 
index ee66b90..82a5cbf 100755 (executable)
@@ -24,13 +24,13 @@ tmp=$WORKTMP/install_cd
 iso_build_dir=$tmp/build
 
 input_image=$(readlink -f ${1:-$WORKTMP/goldenimage/$GOLDEN_IMAGE_NAME})
-output_image_path=${2:-$RESULT_IMAGES_DIR/rec.iso}
+output_image_path=${2:-$RESULT_IMAGES_DIR/install.iso}
 output_bootcd_path=${3:-$RESULT_IMAGES_DIR/bootcd.iso}
 mkdir -p $tmp
 rm -rf $iso_build_dir
 mkdir -p $iso_build_dir
 
-reposnap_base=$(_read_build_config DEFAULT centos_reposnap_base)
+reposnap_base=$(_read_build_config DEFAULT centos_reposnap)
 release_version=$PRODUCT_RELEASE_LABEL
 reposnap_base_dir="${reposnap_base}/os/x86_64/"
 iso_image_label=$(_read_build_config DEFAULT iso_image_label)
@@ -42,13 +42,6 @@ remove_extra_slashes_from_url() {
   echo $1 | sed -re 's#([^:])//+#\1/#g'
 }
 
-get_nexus() {
- $scriptdir/nexus3_dl.sh \
-    $nexus_url \
-    $(basename $nexus_reposnaps) \
-    ${reposnap_base#$nexus_reposnaps/}/os/x86_64 $@
-}
-
 wget_dir() {
   local url=$1
   echo $url | grep -q /$ || _abort "wget path '$url' must end with slash for recursive wget"
@@ -62,19 +55,11 @@ wget_dir() {
 pushd $iso_build_dir
 
 # Get files needed for generating CD image.
-if echo $reposnap_base_dir | grep -E "https?://nexus3"; then
-  nexus_url=$(_read_build_config DEFAULT nexus_url)
-  nexus_reposnaps=$(_read_build_config DEFAULT nexus_reposnaps)
-  get_nexus "EFI/BOOT" "EFI/BOOT/fonts"
-  get_nexus "images:*efiboot.img" "images/pxeboot"
-  get_nexus "isolinux"
-else
-  wget_dir ${cd_efi_dir}/
-  wget_dir ${cd_images_dir}/
-  rm -rf images/boot.iso
-  sync
-  wget_dir ${cd_isolinux_dir}/
-fi
+wget_dir ${cd_efi_dir}/
+wget_dir ${cd_images_dir}/
+rm -rf images/boot.iso
+sync
+wget_dir ${cd_isolinux_dir}/
 chmod +w -R isolinux/ EFI/ images/
 
 if [ -e $scriptdir/isolinux/isolinux.cfg ]; then
index dad25b4..ceb9a90 100755 (executable)
@@ -21,7 +21,7 @@ source $scriptdir/lib.sh
 
 output_image_path=${1:-$WORKTMP/goldenimage/$GOLDEN_IMAGE_NAME}
 
-docker_dib_image=dib:2.0
+docker_dib_image=dib
 _load_docker_image $docker_dib_image
 
 docker run \
index 3e0885d..26b6159 100755 (executable)
@@ -18,7 +18,7 @@ set -ex
 scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
 source $scriptdir/lib.sh
 
-docker_image=buildtools:2.0
+docker_image=buildtools
 _load_docker_image $docker_image
 
 function _resolve_abs_path() {
index fa1359f..ffaa975 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
+# Use newer than the CentOS stock diskimage-builder via "cloud" repo
 FROM centos:7.5.1804
 RUN \
-    yum-config-manager --add-repo http://mirror.centos.org/centos/7/cloud/x86_64/openstack-pike/ && \
-    yum-config-manager --add-repo https://trunk.rdoproject.org/centos7-pike/57/c7/57c7be250c919c04b51361d4d42e95818cfec5a5_15fc9723 && \
+    yum-config-manager --add-repo http://mirror.centos.org/centos/7/cloud/x86_64/openstack-queens/ && \
     yum install --nogpgcheck -y diskimage-builder \
         git \
         python \
diff --git a/lib.sh b/lib.sh
index ecd1121..50cf9b8 100644 (file)
--- a/lib.sh
+++ b/lib.sh
@@ -189,11 +189,11 @@ function _get_package_list()
 function _load_docker_image()
 {
   local docker_image=$1
-  local docker_image_url="$(_read_build_config DEFAULT docker_images)/${docker_image}.tar"
   if docker inspect ${docker_image} &> /dev/null; then
     echo "Using already built ${docker_image} image"
   else
     echo "Loading ${docker_image} image"
+    local docker_image_url="$(_read_build_config DEFAULT docker_images)/${docker_image}.tar"
     curl -L $docker_image_url | docker load
   fi
 }
diff --git a/nexus3_dl.sh b/nexus3_dl.sh
deleted file mode 100755 (executable)
index 03dd7ed..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -eu
-
-NEXUS_URL=$1
-NEXUS_REPOSITORY=$2
-NEXUS_REPOSITORY_BASE_PATH=$3
-shift;shift;shift
-NEXUS_REPOSITORY_SEARCH_PATTERNS=$@
-
-_abort() {
-  echo "ERROR: $@"
-  exit 1
-}
-
-_search_group() {
-  local params=""
-  [ -n "$1" ] && params+="&group=$1"
-  [ -n "${2:-}" ] && params+="&name=$2"
-  curl "${NEXUS_URL}/service/rest/v1/search?repository=${NEXUS_REPOSITORY}${params}"
-}
-
-for pat in $NEXUS_REPOSITORY_SEARCH_PATTERNS; do
-  search_group="/$NEXUS_REPOSITORY_BASE_PATH/$(echo $pat | cut -d':' -f1)"
-  search_name=""
-  if echo $pat | grep ':'; then
-      search_name="$(echo $pat | cut -d':' -f2)"
-  fi
-  resp=$(_search_group $search_group $search_name)
-  if [ "$(echo $resp | jq -r '.continuationToken')" != "null" ]; then
-    _abort "Pagination not implemented"
-  fi
-  for url in $(echo $resp | jq -r '.items[].assets[].downloadUrl'); do
-    to=${url#$NEXUS_URL/repository/$NEXUS_REPOSITORY/$NEXUS_REPOSITORY_BASE_PATH/}
-    mkdir -p $(dirname $to)
-    echo "Fetch $url"
-    curl $url > $to
-  done
-done