rubik: add build folder for container image build
Signed-off-by: DCCooper <1866858@gmail.com>
This commit is contained in:
parent
40b859214c
commit
4d19602e9c
@ -1 +0,0 @@
|
|||||||
1.0.0-4
|
|
||||||
1
VERSION-vendor
Normal file
1
VERSION-vendor
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0.0-5
|
||||||
@ -10,7 +10,7 @@ set -ex
|
|||||||
pkg=rubik
|
pkg=rubik
|
||||||
cwd=$PWD
|
cwd=$PWD
|
||||||
src=$cwd/$pkg
|
src=$cwd/$pkg
|
||||||
tar_file=v"$(awk -F"-" '{print $1}' < VERSION-openeuler)".tar.gz
|
tar_file=v"$(awk -F"-" '{print $1}' < VERSION-vendor)".tar.gz
|
||||||
|
|
||||||
mkdir ${src} && tar -zxvf "${tar_file}" -C ${src} --strip-components 1
|
mkdir ${src} && tar -zxvf "${tar_file}" -C ${src} --strip-components 1
|
||||||
if [ ! -d patch ]; then
|
if [ ! -d patch ]; then
|
||||||
@ -28,5 +28,5 @@ done <"$series"
|
|||||||
|
|
||||||
cd $cwd
|
cd $cwd
|
||||||
cp -rf $src/* .
|
cp -rf $src/* .
|
||||||
cp -f VERSION-openeuler VERSION
|
cp -f VERSION-vendor VERSION
|
||||||
rm -rf $src
|
rm -rf $src
|
||||||
|
|||||||
44
build_rubik_image.sh
Executable file
44
build_rubik_image.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
###################################################################################################
|
||||||
|
# Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved.
|
||||||
|
# rubik licensed under the Mulan PSL v2.
|
||||||
|
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
# You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
# http://license.coscl.org.cn/MulanPSL2
|
||||||
|
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||||
|
# PURPOSE.
|
||||||
|
# See the Mulan PSL v2 for more details.
|
||||||
|
# Author: Xiang Li
|
||||||
|
# Create: 2022-11-29
|
||||||
|
# Description: Build container image for rubik. Enjoy and cherrs!
|
||||||
|
# Steps:
|
||||||
|
# 1. build image and tag it with rubik version and release number
|
||||||
|
# 2. modify `rubik-daemonset.yaml` file
|
||||||
|
###################################################################################################
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CURRENT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
BINARY_NAME="rubik"
|
||||||
|
|
||||||
|
RUBIK_FILE="${CURRENT_DIR}/build/rubik"
|
||||||
|
DOCKERFILE="${CURRENT_DIR}/Dockerfile"
|
||||||
|
YAML_FILE="${CURRENT_DIR}/rubik-daemonset.yaml"
|
||||||
|
|
||||||
|
# Get version and release number of rubik binary
|
||||||
|
VERSION=$(${RUBIK_FILE} -v | grep ^Version | awk '{print $NF}')
|
||||||
|
RELEASE=$(${RUBIK_FILE} -v | grep ^Release | awk '{print $NF}')
|
||||||
|
IMG_TAG="${VERSION}-${RELEASE}"
|
||||||
|
|
||||||
|
# Get rubik image name and tag
|
||||||
|
IMG_NAME_AND_TAG="${BINARY_NAME}:${IMG_TAG}"
|
||||||
|
|
||||||
|
# Build container image for rubik
|
||||||
|
docker build -f "${DOCKERFILE}" -t "${IMG_NAME_AND_TAG}" "${CURRENT_DIR}"
|
||||||
|
|
||||||
|
echo -e "\n"
|
||||||
|
# Check image existence
|
||||||
|
docker images | grep -E "REPOSITORY|${BINARY_NAME}"
|
||||||
|
|
||||||
|
# Modify rubik-daemonset.yaml file, set rubik image name
|
||||||
|
sed -i "s/rubik_image_name_and_tag/${IMG_NAME_AND_TAG}/g" "${YAML_FILE}"
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
# Basic info
|
# Basic info
|
||||||
top_dir=$(git rev-parse --show-toplevel)
|
top_dir=$(git rev-parse --show-toplevel)
|
||||||
version_file="${top_dir}/VERSION-openeuler"
|
version_file="${top_dir}/VERSION-vendor"
|
||||||
spec_file="${top_dir}/rubik.spec"
|
spec_file="${top_dir}/rubik.spec"
|
||||||
color=$(tput setaf 2) # red
|
color=$(tput setaf 2) # red
|
||||||
color_reset=$(tput sgr0)
|
color_reset=$(tput sgr0)
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
333208525a24588c45bd34b048a5ae82803efaad
|
8e373d25ff4a5b76c9dc1735a40098254f49e1c6
|
||||||
|
|||||||
22
rubik.spec
22
rubik.spec
@ -1,16 +1,17 @@
|
|||||||
Name: rubik
|
Name: rubik
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: Hybrid Deployment for Cloud Native
|
Summary: Hybrid Deployment for Cloud Native
|
||||||
License: Mulan PSL V2
|
License: Mulan PSL V2
|
||||||
URL: https://gitee.com/openeuler/rubik
|
URL: https://gitee.com/openeuler/rubik
|
||||||
Source0: https://gitee.com/openeuler/rubik/repository/archive/v%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/rubik/repository/archive/v%{version}.tar.gz
|
||||||
Source1: git-commit
|
Source1: git-commit
|
||||||
Source2: VERSION-openeuler
|
Source2: VERSION-vendor
|
||||||
Source3: apply-patch
|
Source3: apply-patch
|
||||||
Source4: gen-version.sh
|
Source4: gen-version.sh
|
||||||
Source5: series.conf
|
Source5: series.conf
|
||||||
Source6: patch.tar.gz
|
Source6: patch.tar.gz
|
||||||
|
Source7: build_rubik_image.sh
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: golang >= 1.13
|
BuildRequires: golang >= 1.13
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ cp %{SOURCE3} .
|
|||||||
cp %{SOURCE4} .
|
cp %{SOURCE4} .
|
||||||
cp %{SOURCE5} .
|
cp %{SOURCE5} .
|
||||||
cp %{SOURCE6} .
|
cp %{SOURCE6} .
|
||||||
|
cp %{SOURCE7} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
sh ./apply-patch
|
sh ./apply-patch
|
||||||
@ -34,22 +36,32 @@ strip ./build/rubik
|
|||||||
%install
|
%install
|
||||||
# create directory /var/lib/rubik
|
# create directory /var/lib/rubik
|
||||||
install -d %{buildroot}%{_sharedstatedir}/%{name}
|
install -d %{buildroot}%{_sharedstatedir}/%{name}
|
||||||
# install rubik binary
|
# create directory /var/lib/rubik/build for image build
|
||||||
install -Dp ./build/rubik %{buildroot}%{_sharedstatedir}/%{name}
|
install -d %{buildroot}%{_sharedstatedir}/%{name}/build
|
||||||
|
# install rubik binary to build folder
|
||||||
|
install -Dp ./build/rubik %{buildroot}%{_sharedstatedir}/%{name}/build
|
||||||
# install artifacts
|
# install artifacts
|
||||||
install -Dp ./hack/rubik-daemonset.yaml %{buildroot}%{_sharedstatedir}/%{name}/rubik-daemonset.yaml
|
install -Dp ./hack/rubik-daemonset.yaml %{buildroot}%{_sharedstatedir}/%{name}/rubik-daemonset.yaml
|
||||||
install -Dp ./Dockerfile %{buildroot}%{_sharedstatedir}/%{name}/Dockerfile
|
install -Dp ./Dockerfile %{buildroot}%{_sharedstatedir}/%{name}/Dockerfile
|
||||||
|
install -Dp ./build_rubik_image.sh %{buildroot}%{_sharedstatedir}/%{name}/build_rubik_image.sh
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%dir %attr(750,root,root) %{_sharedstatedir}/%{name}
|
%dir %attr(750,root,root) %{_sharedstatedir}/%{name}
|
||||||
%attr(550,root,root) %{_sharedstatedir}/%{name}/rubik
|
%attr(550,root,root) %{_sharedstatedir}/%{name}/build/rubik
|
||||||
%attr(640,root,root) %{_sharedstatedir}/%{name}/rubik-daemonset.yaml
|
%attr(640,root,root) %{_sharedstatedir}/%{name}/rubik-daemonset.yaml
|
||||||
%attr(640,root,root) %{_sharedstatedir}/%{name}/Dockerfile
|
%attr(640,root,root) %{_sharedstatedir}/%{name}/Dockerfile
|
||||||
|
%attr(550,root,root) %{_sharedstatedir}/%{name}/build_rubik_image.sh
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 29 2022 CooperLi <a710905118@163.com> - 1.0.0-5
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:restart
|
||||||
|
- DESC:add build folder for container image build
|
||||||
|
|
||||||
* Mon Nov 21 2022 yangjiaqi <yangjiaqi16@huawei.com> - 1.0.0-4
|
* Mon Nov 21 2022 yangjiaqi <yangjiaqi16@huawei.com> - 1.0.0-4
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user