From babc0e6e3323efc2d8a0e1795c3cf48ad4f36e72 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 5 Aug 2024 17:08:06 +0200 Subject: [PATCH] build_docker_aci, build_library: Remove obsolete scripts The build_docker_aci script only supported docker 12.x, which we don't have since ages, so it's a clear sign of a script being obsolete. Removing it results in some other scripts in build_library being unused, so drop them too. --- build_docker_aci | 110 --------------------------- build_library/ebuild_aci_manifest.in | 14 ---- build_library/ebuild_aci_util.sh | 97 ----------------------- 3 files changed, 221 deletions(-) delete mode 100755 build_docker_aci delete mode 100644 build_library/ebuild_aci_manifest.in delete mode 100644 build_library/ebuild_aci_util.sh diff --git a/build_docker_aci b/build_docker_aci deleted file mode 100755 index 4613f57ffe..0000000000 --- a/build_docker_aci +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 The CoreOS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This is a wrapper around the ebuild_aci_util.sh functions to set up the -# necessary environment, similar to the build_image script. - -SCRIPT_ROOT=$(dirname $(readlink -f "$0")) -. "${SCRIPT_ROOT}/common.sh" || exit 1 - -# Script must run inside the chroot -assert_inside_chroot - -assert_not_root_user - -# Developer-visible flags. -DEFINE_string board "${DEFAULT_BOARD}" \ - "The board to build an image for." -DEFINE_string build_dir "" \ - "Directory in which to place image result directories (named by version)" -DEFINE_boolean getbinpkg "${FLAGS_FALSE}" \ - "Download binary packages from remote repository." -DEFINE_string getbinpkgver "" \ - "Use binary packages from a specific version." - -FLAGS_HELP="USAGE: build_docker_aci [flags] [docker version] [aci version number]. -This script is used to build a CoreOS docker-skim ACI. - -The docker version should identify an existent ebuild (i.e. -app-containers/docker-\$version). - -The aci version number is an atomically incrementing number that will be -appended to the aci version (to create e.g. :v1.12.6_coreos.0). - -Examples: - -build_docker_aci --board=amd64-usr --build_dir= 1.12.6 0 -... -" -show_help_if_requested "$@" - -# The following options are advanced options, only available to those willing -# to read the source code. They are not shown in help output, since they are -# not needed for the typical developer workflow. -DEFINE_integer build_attempt 1 \ - "The build attempt for this image build." -DEFINE_string group "docker-aci" \ - "The update group (not used for actual updates here)" -DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ - "Directory in which to place image result directories (named by version)" -DEFINE_string version "" \ - "Sets the docker version to build." -DEFINE_integer aci_version "" \ - "Sets the aci version tag identifier." - -# Parse command line. -FLAGS "$@" || exit 1 -[ -z "${FLAGS_ARGV}" ] && echo 'No version given' && exit 0 -eval set -- "${FLAGS_ARGV}" - -version="${1:?Docker version}" -aci_version="${2:?Docker version}" - - -# Only now can we die on error. shflags functions leak non-zero error codes, -# so will die prematurely if 'switch_to_strict_mode' is specified before now. -switch_to_strict_mode - -# If downloading packages is enabled ensure the board is configured properly. -if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then - "${SRC_ROOT}/scripts/setup_board" --board="${FLAGS_board}" \ - --getbinpkgver="${FLAGS_getbinpkgver}" --regen_configs_only -fi - -# N.B. Ordering matters for some of the libraries below, because -# some of the files contain initialization used by later files. -. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/prod_image_util.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/ebuild_aci_util.sh" || exit 1 - -BUILD_DIR=${FLAGS_build_dir:-$BUILD_DIR} - -case "${version}" in - 1.12.[0-9]*) - packaged_files=( - "/usr/bin/docker" - "/usr/bin/dockerd" - "/usr/bin/docker-containerd" - "/usr/bin/docker-containerd-shim" - "/usr/bin/docker-proxy" - "/usr/bin/docker-runc" - "/usr/lib/flatcar/dockerd" - ) - ebuild_aci_create "users.developer.core-os.net/skim/docker" \ - "coreos_docker-${BOARD}-${version}_coreos.${aci_version}" \ - "app-containers/docker" \ - "${version}" \ - "${aci_version}" \ - "${packaged_files[@]}" - ;; - *) - 1>&2 echo "Unrecognized version; please enter a supported version" - exit 1 - ;; -esac diff --git a/build_library/ebuild_aci_manifest.in b/build_library/ebuild_aci_manifest.in deleted file mode 100644 index 17365203a1..0000000000 --- a/build_library/ebuild_aci_manifest.in +++ /dev/null @@ -1,14 +0,0 @@ -{ - "acKind": "ImageManifest", - "acVersion": "0.8.6", - "name": "@ACI_NAME@", - "labels": [ - {"name": "arch", "value": "@ACI_ARCH@"}, - {"name": "os", "value": "linux"}, - {"name": "version", "value": "@ACI_VERSION@"} - ], - "app": { - "user": "0", - "group": "0" - } -} diff --git a/build_library/ebuild_aci_util.sh b/build_library/ebuild_aci_util.sh deleted file mode 100644 index b25449bc19..0000000000 --- a/build_library/ebuild_aci_util.sh +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (c) 2016 The CoreOS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Expects BOARD, BUILD_DIR, BUILD_LIBRARY_DIR, and FLATCAR_VERSION in env. - -# Copied from create_prod_image() -create_ebuild_aci_image() { - local image_name="$1" - local disk_layout="$2" - local update_group="$3" - local pkg="$4" - - info "Building ACI staging image ${image_name}" - local root_fs_dir="${BUILD_DIR}/rootfs" - local image_contents="${image_name%.bin}_contents.txt" - local image_packages="${image_name%.bin}_packages.txt" - local image_licenses="${image_name%.bin}_licenses.json" - - start_image \ - "${image_name}" "${disk_layout}" "${root_fs_dir}" "${update_group}" - - # Install minimal GCC (libs only) and then everything else - extract_prod_gcc "${root_fs_dir}" - - emerge_to_image_unchecked "${root_fs_dir}" "${pkg}" - run_ldconfig "${root_fs_dir}" - write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}" - write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}" - insert_licenses "${BUILD_DIR}/${image_licenses}" "${root_fs_dir}" - - cleanup_mounts "${root_fs_dir}" - trap - EXIT -} - -ebuild_aci_write_manifest() { - local manifest="${1?No output path was specified}" - local name="${2?No ACI name was specified}" - local version="${3?No ACI version was specified}" - local appc_arch= - - case "${BOARD}" in - amd64-usr) appc_arch=amd64 ;; - arm64-usr) appc_arch=aarch64 ;; - *) die_notrace "Cannot map \"${BOARD}\" to an appc arch" ;; - esac - - sudo cp "${BUILD_LIBRARY_DIR}/ebuild_aci_manifest.in" "${manifest}" - sudo sed "${manifest}" -i \ - -e "s,@ACI_NAME@,${name}," \ - -e "s,@ACI_VERSION@,${version}," \ - -e "s,@ACI_ARCH@,${appc_arch}," -} - -ebuild_aci_create() { - local aciroot="${BUILD_DIR}" - local aci_name="${1?No aci name was specified}"; shift - local output_image="${1?No output file specified}"; shift - local pkg="${1?No package given}"; shift - local version="${1?No package version given}"; shift - local extra_version="${1?No extra version number given}"; shift - local pkg_files=( "${@}" ) - - local staging_image="flatcar_pkg_staging_aci_stage.bin" - - local ebuild_atom="=${pkg}-${version}" - - local ebuild=$(equery-"${BOARD}" w "${ebuild_atom}" 2>/dev/null) - [ -n "${ebuild}" ] || die_notrace "No ebuild exists for ebuild \"${pkg}\"" - - # Build a staging image for this ebuild. - create_ebuild_aci_image "${staging_image}" container stable "${ebuild_atom}" - - # Remount the staging image to brutalize the rootfs for broken services. - "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout=container \ - mount "${BUILD_DIR}/${staging_image}" "${aciroot}/rootfs" - trap "cleanup_mounts '${aciroot}/rootfs' && delete_prompt" EXIT - - # Substitute variables into the manifest to produce the final version. - ebuild_aci_write_manifest \ - "${aciroot}/manifest" \ - "${aci_name}" \ - "${version}_flatcar.${extra_version}" - - local pkg_files_in_rootfs=( "${pkg_files[@]/#/rootfs}" ) - - # Write a tar ACI file containing the manifest and desired parts of the mounted rootfs - sudo tar -C "${aciroot}" -hczf "${BUILD_DIR}/${output_image}.aci" \ - manifest ${pkg_files_in_rootfs[@]} - - # Unmount the staging image, and delete it to save space. - cleanup_mounts "${aciroot}/rootfs" - trap - EXIT - rm -f "${BUILD_DIR}/${staging_image}" - - echo "Created aci for ${pkg}-${version}: ${BUILD_DIR}/${output_image}.aci" -}