!7 docker: use git-commit to store commit ID

Merge pull request !7 from Vanient/master
This commit is contained in:
openeuler-ci-bot 2020-06-24 15:47:54 +08:00 committed by Gitee
commit 7452979469
6 changed files with 74 additions and 6 deletions

View File

@ -12,6 +12,9 @@ cwd=$PWD
src=$cwd/$pkg src=$cwd/$pkg
tar -xzvf $pkg.tar.gz tar -xzvf $pkg.tar.gz
if [ ! -d patch ];then
tar -xzf patch.tar.gz
fi
cd $src cd $src
git init git init
@ -38,6 +41,8 @@ else
cp -rf $src/* . cp -rf $src/* .
cp -rf VERSION-openeuler $cwd/components/cli/ cp -rf VERSION-openeuler $cwd/components/cli/
cp -rf VERSION-openeuler $cwd/components/engine/ cp -rf VERSION-openeuler $cwd/components/engine/
cp -rf git-commit $cwd/components/cli/
cp -rf git-commit $cwd/components/engine/
fi fi
mv $src/.git $src/git mv $src/.git $src/git

View File

@ -1,11 +1,17 @@
Name: docker-engine Name: docker-engine
Version: 18.09.0 Version: 18.09.0
Release: 104 Release: 105
Summary: The open-source application container engine Summary: The open-source application container engine
Group: Tools/Docker Group: Tools/Docker
License: ASL 2.0 License: ASL 2.0
Source: %{name}.tar.gz Source0: docker-ce-18.09.0.tar.gz
Source1: patch.tar.gz
Source2: apply-patches
Source3: git-commit
Source4: series.conf
Source5: VERSION-openeuler
Source6: gen-commit.sh
URL: https://mobyproject.org URL: https://mobyproject.org
@ -38,17 +44,21 @@ for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider. depending on a particular stack or provider.
%prep %prep
%autosetup -c -n %{name} cp %{SOURCE0} .
cp %{SOURCE1} .
cp %{SOURCE2} .
cp %{SOURCE3} .
cp %{SOURCE4} .
cp %{SOURCE5} .
%build %build
./apply-patches sh ./apply-patches
# build docker engine # build docker engine
WORKDIR=$(pwd) WORKDIR=$(pwd)
GITCOMMIT=$(git rev-parse --short HEAD)
export VERSION=$(cat VERSION) export VERSION=$(cat VERSION)
export DOCKER_GITCOMMIT=${GITCOMMIT} export DOCKER_GITCOMMIT=$(cat git-commit | head -c 7)
export AUTO_GOPATH=1 export AUTO_GOPATH=1
export DOCKER_BUILDTAGS="pkcs11 seccomp selinux" export DOCKER_BUILDTAGS="pkcs11 seccomp selinux"
cd ${WORKDIR}/components/engine cd ${WORKDIR}/components/engine

12
gen-commit.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
# Description: This shell script is used to generate commitID store file.
# Author: xiadanni1@huawei.com
# Create: 2020-06-09
changeID=`git log -1 | grep Change-Id | awk '{print $2}'`
if [ "${changeID}" = "" ];then
changeID=`date | sha256sum | head -c 40`
fi
echo "${changeID}" > git-commit

1
git-commit Normal file
View File

@ -0,0 +1 @@
Id13ecdba61708f62595d6db593c670c304abf0bb

View File

@ -0,0 +1,39 @@
From edfe32735e5eaf614107710c8a187eddf0ccac89 Mon Sep 17 00:00:00 2001
From: xiadanni1 <xiadanni1@huawei.com>
Date: Wed, 10 Jun 2020 01:44:18 +0800
Subject: [PATCH] docker: use git-commit to store commit ID
Signed-off-by: xiadanni1 <xiadanni1@huawei.com>
---
components/cli/scripts/build/.variables | 2 +-
components/engine/hack/make.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/cli/scripts/build/.variables b/components/cli/scripts/build/.variables
index 86d0e3a..a23e379 100755
--- a/components/cli/scripts/build/.variables
+++ b/components/cli/scripts/build/.variables
@@ -4,7 +4,7 @@ set -eu
PLATFORM=${PLATFORM:-}
VERSION=${VERSION:-"unknown-version"}
EULERVERSION=${EULERVERSION:-$(cat VERSION-openeuler)}
-GITCOMMIT=${GITCOMMIT:-$(git rev-parse --short HEAD 2> /dev/null || true)}
+GITCOMMIT=${GITCOMMIT:-$(cat git-commit | head -c 7)}
BUILDTIME=${BUILDTIME:-$(date --utc --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')}
PLATFORM_LDFLAGS=
diff --git a/components/engine/hack/make.sh b/components/engine/hack/make.sh
index 686e688..f4a51e7 100755
--- a/components/engine/hack/make.sh
+++ b/components/engine/hack/make.sh
@@ -68,6 +68,7 @@ DEFAULT_BUNDLES=(
VERSION_EULER=$(< ./VERSION-openeuler)
VERSION=${VERSION:-dev}
! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
+DOCKER_GITCOMMIT=$(cat git-commit | head -c 7)
if [ "$DOCKER_GITCOMMIT" ]; then
GITCOMMIT="$DOCKER_GITCOMMIT"
elif command -v git &> /dev/null && [ -e .git ] && git rev-parse &> /dev/null; then
--
1.8.3.1

View File

@ -159,3 +159,4 @@ patch/0160-docker-create-a-soft-link-from-runtime-default-to-ru.patch
patch/0161-docker-Delete-stale-containerd-object-on-start-f.patch patch/0161-docker-Delete-stale-containerd-object-on-start-f.patch
patch/0162-docker-delete-event-is-not-need-to-process.patch patch/0162-docker-delete-event-is-not-need-to-process.patch
patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch
patch/0164-docker-use-git-commit-to-store-commit-ID.patch