diff --git a/README.en.md b/README.en.md deleted file mode 100644 index b48bea9..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# rubik - -#### Description -rubik is a QoS manager agent for online/offline workload colocation - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 7e83837..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# rubik - -#### 介绍 -rubik is a QoS manager agent for online/offline workload colocation - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/VERSION-openeuler b/VERSION-openeuler new file mode 100644 index 0000000..5d9547c --- /dev/null +++ b/VERSION-openeuler @@ -0,0 +1 @@ +0.1.0-1 diff --git a/apply-patch b/apply-patch new file mode 100755 index 0000000..8c0ab1e --- /dev/null +++ b/apply-patch @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. +# Description: This shell script is used to apply patches for the project +# Author: rubik team +# Create: 2021-12-27 + +set -ex + +pkg=rubik +cwd=$PWD +src=$cwd/$pkg +tar_file=v"$(awk -F"-" '{print $1}' < VERSION-openeuler)".tar.gz + +mkdir ${src} && tar -zxvf "${tar_file}" -C ${src} --strip-components 1 +if [ ! -d patch ]; then + tar -zxvf patch.tar.gz +fi + +series=$cwd/series.conf +while IPF= read -r line +do + if [[ "$line" =~ ^patch* ]]; then + echo patch -p1 $cwd/$line + cd $src && patch -p1 < $cwd/$line + fi +done <"$series" + +cd $cwd +cp -rf $src/* . +cp -f VERSION-openeuler VERSION +rm -rf $src diff --git a/gen-version.sh b/gen-version.sh new file mode 100755 index 0000000..eff17e3 --- /dev/null +++ b/gen-version.sh @@ -0,0 +1,86 @@ +#!/bin/bash +################################################################################################### +# Copyright (c) Huawei Technologies Co., Ltd. 2021. 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: 2021-12-27 +# Description: This script used for update rubik version and release. Enjoy and cherrs +################################################################################################### + +# Basic info +top_dir=$(git rev-parse --show-toplevel) +version_file="${top_dir}/VERSION-openeuler" +spec_file="${top_dir}/rubik.spec" +color=$(tput setaf 2) # red +color_reset=$(tput sgr0) + +# Commit ID +changeID=$(git log -1 | grep Change-Id | awk '{print $2}' | head -c 40) +if [ "${changeID}" = "" ]; then + changeID=$(date | sha256sum | head -c 40) +fi +echo "${changeID}" > "${top_dir}"/git-commit +old_all=$(cat "${version_file}") +old_version=$(awk -F"-" '{print $1}' < "${version_file}") +old_release=$(awk -F"-" '{print $2}' < "${version_file}") +major_old_version=$(echo "${old_version}" | awk -F "." '{print $1}') +minor_old_version=$(echo "${old_version}" | awk -F "." '{print $2}') +revision_old_version=$(echo "${old_version}" | awk -F "." '{print $3}') + +# Read user input +read -rp "update version: Major(1), Minor(2), Revision(3), Release(4) [1/2/3/4]: " input +case ${input} in + 1) + major_old_version=$((major_old_version + 1)) + minor_old_version="0" + revision_old_version="0" + new_release_num="1" + ;; + 2) + minor_old_version=$((minor_old_version + 1)) + revision_old_version="0" + new_release_num="1" + ;; + 3) + revision_old_version=$((revision_old_version + 1)) + new_release_num="1" + ;; + 4) + new_release_num=$((old_release + 1)) + ;; + *) + echo "Wrong input, Version Not modified: ${old_version}" + exit 0 + ;; +esac + +author=$(git config user.name) +email=$(git config user.email) + +# VERSION format: +# Major.Minor.Revision +new_version=${major_old_version}.${minor_old_version}.${revision_old_version} +new_release="${new_release_num}" +new_all=${new_version}-${new_release} +new_changelog=$( + cat << EOF +* $(LC_ALL="C" date '+%a %b %d %Y') $author <$email> - $new_all\n- Type:\n- CVE:\n- SUG:\n- DESC:\n +EOF +) + +# Replace version and release for spec and VERSION files +sed -i -e "s/^Version: .*$/Version: ${new_version}/g" "${spec_file}" +sed -i -e "s/^Release: .*$/Release: ${new_release}/g" "${spec_file}" +sed -i -e "/\%changelog/a$new_changelog" "${spec_file}" +echo "${new_all}" > "${version_file}" + +if [[ "${old_all}" != "${new_all}" ]]; then + printf 'Version: %s -> %s\n' "${old_all}" "${color}${new_all}${color_reset}" +fi diff --git a/git-commit b/git-commit new file mode 100644 index 0000000..081b5f4 --- /dev/null +++ b/git-commit @@ -0,0 +1 @@ +b4055f46c22a55e145987bac8e0a05f238c6d18b diff --git a/patch/0001-rubik-enable-GO111MODULE.patch b/patch/0001-rubik-enable-GO111MODULE.patch new file mode 100644 index 0000000..58b3694 --- /dev/null +++ b/patch/0001-rubik-enable-GO111MODULE.patch @@ -0,0 +1,34 @@ +From 83370df1083223fb14c4277e13b2ebeaa9e03352 Mon Sep 17 00:00:00 2001 +From: xiadanni +Date: Mon, 27 Dec 2021 16:52:03 +0800 +Subject: [PATCH] rubik: enable GO111MODULE + +Signed-off-by: xiadanni +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 22ea08c..7cd1185 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,14 +32,14 @@ LD_FLAGS := -ldflags '-buildid=none -tmpdir=$(TMP_DIR) \ + -extldflags=-ftrapv \ + -extldflags=-Wl,-z,relro,-z,now -linkmode=external -extldflags=-static' + +-export GO111MODULE=off ++export GO111MODULE=on + + GO_BUILD=CGO_ENABLED=1 \ + CGO_CFLAGS="-fstack-protector-strong -fPIE" \ + CGO_CPPFLAGS="-fstack-protector-strong -fPIE" \ + CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \ + CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \ +- go build -buildmode=pie ++ go build -mod=vendor -buildmode=pie + + all: release + +-- +2.27.0 + diff --git a/rubik.spec b/rubik.spec new file mode 100644 index 0000000..816c2c2 --- /dev/null +++ b/rubik.spec @@ -0,0 +1,53 @@ +Name: rubik +Version: 0.1.0 +Release: 1 +Summary: Hybrid Deployment for Cloud Native +License: Mulan PSL V2 +URL: https://gitee.com/openeuler/rubik +Source0: https://gitee.com/openeuler/rubik/repository/archive/v%{version}.tar.gz +Source1: git-commit +Source2: VERSION-openeuler +Source3: apply-patch +Source4: gen-version.sh +Source5: series.conf +Source6: patch.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: golang >= 1.13 + +%description +This is hybrid deployment component for cloud native, it should be running in kubernetes environment. + +%prep +cp %{SOURCE0} . +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . +cp %{SOURCE4} . +cp %{SOURCE5} . +cp %{SOURCE6} . + +%build +sh ./apply-patch +make release + +%install +# create directory /var/lib/rubik +install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name} +# install rubik binary +install -Dp -m 0550 ./rubik %{buildroot}%{_sharedstatedir}/%{name} +# install artifacts +install -Dp -m 0640 ./hack/rubik-daemonset.yaml %{buildroot}%{_sharedstatedir}/%{name}/rubik-daemonset.yaml +install -Dp -m 0640 ./Dockerfile %{buildroot}%{_sharedstatedir}/%{name}/Dockerfile + +%files +%dir %{_sharedstatedir}/%{name} +%{_sharedstatedir}/%{name}/rubik +%{_sharedstatedir}/%{name}/rubik-daemonset.yaml +%{_sharedstatedir}/%{name}/Dockerfile + +%clean +rm -rf %{buildroot} + +%changelog +* Mon Dec 27 2021 xiadanni - 0.1.0-1 +- Package init diff --git a/series.conf b/series.conf new file mode 100644 index 0000000..55d3a48 --- /dev/null +++ b/series.conf @@ -0,0 +1,2 @@ +patch/0001-rubik-enable-GO111MODULE.patch +#end of file diff --git a/v0.1.0.tar.gz b/v0.1.0.tar.gz new file mode 100644 index 0000000..c97b72b Binary files /dev/null and b/v0.1.0.tar.gz differ