mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
obs: Remove golang from osc dockerfile
Reduce pipeline time by not installing golang. golang is not needed to use osc, it makes slower the image creation. - remove go dependency from pacakge lib Remove calls to golang, this will be not not installed in the docker image. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
01238997d0
commit
c7225fe0c8
@ -1,8 +1,6 @@
|
|||||||
FROM opensuse:leap
|
FROM opensuse:leap
|
||||||
|
|
||||||
ARG GO_VERSION=${GO_VERSION:-1.10.2}
|
|
||||||
ARG SUSE_VERSION=${SUSE_VERSION:-42.3}
|
ARG SUSE_VERSION=${SUSE_VERSION:-42.3}
|
||||||
ARG GO_ARCH=${GO_ARCH:-amd64}
|
|
||||||
|
|
||||||
# Get OBS client, plugins and dependencies
|
# Get OBS client, plugins and dependencies
|
||||||
RUN zypper -v -n install osc-plugin-install vim curl bsdtar git sudo
|
RUN zypper -v -n install osc-plugin-install vim curl bsdtar git sudo
|
||||||
@ -15,14 +13,3 @@ RUN zypper -v -n install build \
|
|||||||
obs-service-obs_scm \
|
obs-service-obs_scm \
|
||||||
obs-service-recompress \
|
obs-service-recompress \
|
||||||
obs-service-download_url
|
obs-service-download_url
|
||||||
|
|
||||||
# Set Go environment
|
|
||||||
RUN curl -OL https://dl.google.com/go/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
|
|
||||||
RUN tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
|
|
||||||
|
|
||||||
# Local build dependencies
|
|
||||||
RUN zypper -v -n install make gcc yum xz pcre-tools
|
|
||||||
|
|
||||||
# Add go compiler to the PATH
|
|
||||||
ENV PATH /usr/local/go/bin:$PATH
|
|
||||||
ENV GOPATH /root/go
|
|
||||||
|
@ -14,10 +14,11 @@ readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
|||||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
readonly versions_txt="versions.txt"
|
readonly versions_txt="versions.txt"
|
||||||
project="kata-containers"
|
project="kata-containers"
|
||||||
ARCH=${ARCH:-$(go env GOARCH)}
|
|
||||||
|
|
||||||
source "${script_dir}/../scripts/lib.sh"
|
source "${script_dir}/../scripts/lib.sh"
|
||||||
|
|
||||||
|
ARCH=${ARCH:-$(arch_to_golang "$(uname -m)")}
|
||||||
|
|
||||||
get_kata_version() {
|
get_kata_version() {
|
||||||
local branch="$1"
|
local branch="$1"
|
||||||
curl -SsL "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION"
|
curl -SsL "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION"
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
# This is a helper library for the setup scripts of each package
|
# This is a helper library for the setup scripts of each package
|
||||||
# in this repository.
|
# in this repository.
|
||||||
|
|
||||||
source ../versions.txt
|
source_dir_pkg_lib=$(dirname "${BASH_SOURCE[ ${#BASH_SOURCE[@]} - 1 ]}")
|
||||||
|
source "${source_dir_pkg_lib}/../../scripts/lib.sh"
|
||||||
|
source "${source_dir_pkg_lib}/../versions.txt"
|
||||||
|
|
||||||
PACKAGING_DIR=/var/packaging
|
PACKAGING_DIR=/var/packaging
|
||||||
LOG_DIR=${PACKAGING_DIR}/build_logs
|
LOG_DIR=${PACKAGING_DIR}/build_logs
|
||||||
|
|
||||||
@ -21,19 +24,28 @@ LOCAL_BUILD=false
|
|||||||
OBS_PUSH=false
|
OBS_PUSH=false
|
||||||
VERBOSE=false
|
VERBOSE=false
|
||||||
|
|
||||||
|
arch_to_golang()
|
||||||
|
{
|
||||||
|
local -r arch="$1"
|
||||||
|
|
||||||
|
case "$arch" in
|
||||||
|
aarch64) echo "arm64";;
|
||||||
|
ppc64le) echo "$arch";;
|
||||||
|
x86_64) echo "amd64";;
|
||||||
|
s390x) echo "s390x";;
|
||||||
|
*) die "unsupported architecture: $arch";;
|
||||||
|
esac
|
||||||
|
}
|
||||||
# Used for debian.control files
|
# Used for debian.control files
|
||||||
# Architecture: The architecture specifies which type of hardware this
|
# Architecture: The architecture specifies which type of hardware this
|
||||||
# package was compiled for.
|
# package was compiled for.
|
||||||
DEB_ARCH="$(go env GOARCH)"
|
|
||||||
|
|
||||||
short_commit_length=10
|
short_commit_length=10
|
||||||
|
|
||||||
if command -v go; then
|
arch=$(uname -m)
|
||||||
export GO_ARCH=$(go env GOARCH)
|
DEB_ARCH=$(arch_to_golang "$arch")
|
||||||
else
|
GO_ARCH=$(arch_to_golang "$arch")
|
||||||
export GO_ARCH=amd64
|
export GO_ARCH
|
||||||
echo "Go not installed using $GO_ARCH to install go in dockerfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
cat <<-EOL
|
cat <<-EOL
|
||||||
|
@ -95,3 +95,16 @@ get_kata_hash_from_tag() {
|
|||||||
repo=$1
|
repo=$1
|
||||||
git ls-remote --tags "https://github.com/${project}/${repo}.git" | grep "refs/tags/${kata_version}^{}" | awk '{print $1}'
|
git ls-remote --tags "https://github.com/${project}/${repo}.git" | grep "refs/tags/${kata_version}^{}" | awk '{print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arch_to_golang()
|
||||||
|
{
|
||||||
|
local -r arch="$1"
|
||||||
|
|
||||||
|
case "$arch" in
|
||||||
|
aarch64) echo "arm64";;
|
||||||
|
ppc64le) echo "$arch";;
|
||||||
|
x86_64) echo "amd64";;
|
||||||
|
s390x) echo "s390x";;
|
||||||
|
*) die "unsupported architecture: $arch";;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user