Browse Source

ci: fix docker local_ydb build

ci: fix docker local_ydb build

Pull Request resolved: #308
Nikita Kozlovskiy 1 year ago
parent
commit
73554a93bd

+ 2 - 16
.github/docker/Dockerfile

@@ -25,28 +25,14 @@ ENV GIT_REPO=$GIT_REPO
 ENV GIT_REF=$GIT_REF
 
 RUN mkdir ydb \
-    && cd ydb \
-    && git init -b main \
-    && git remote add origin $GIT_REPO \
-    && git fetch --depth=1 origin $GIT_REF \
-    && git reset --hard FETCH_HEAD
-
-COPY files/cmake_common.patch /tmp
-COPY files/make-vcs-info.py /tmp
-
-RUN cd ydb \
-    && python3 /tmp/make-vcs-info.py . vcs-info.json \
-    && cat vcs-info.json
-
-
-RUN cd ydb/ && patch -p1 < /tmp/cmake_common.patch
+    && git clone --depth=1 -b "${GIT_REF?}" ${GIT_REPO?}
 
 RUN --mount=type=secret,id=ccache_remote_storage \
     mkdir build && cd build \
     && export CONAN_USER_HOME=/ydbwork/build \
     && export CCACHE_BASEDIR=/ydbwork/ \
     && export CCACHE_SLOPPINESS=locale \
-    && export CCACHE_REMOTE_STORAGE="$( cat /run/secrets/ccache_remote_storage)" \
+    && export CCACHE_REMOTE_STORAGE="$(cat /run/secrets/ccache_remote_storage)" \
     && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
         -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache \
         -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \

+ 0 - 13
.github/docker/files/cmake_common.patch

@@ -1,13 +0,0 @@
-diff --git a/cmake/common.cmake b/cmake/common.cmake
-index 00f970a036..0408e57701 100644
---- a/cmake/common.cmake
-+++ b/cmake/common.cmake
-@@ -162,7 +162,7 @@ endfunction()
- function(vcs_info Tgt)
-   add_custom_command(
-     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c
--    COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/vcs_info.py no-vcs dummy.json ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c ${CMAKE_SOURCE_DIR}/build/scripts/c_templates/svn_interface.c
-+    COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/vcs_info.py ${CMAKE_SOURCE_DIR}/vcs-info.json ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c ${CMAKE_SOURCE_DIR}/build/scripts/c_templates/svn_interface.c
-     DEPENDS ${CMAKE_SOURCE_DIR}/build/scripts/vcs_info.py ${CMAKE_SOURCE_DIR}/build/scripts/c_templates/svn_interface.c
-   )
-   target_sources(${Tgt} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c)

+ 0 - 43
.github/docker/files/make-vcs-info.py

@@ -1,43 +0,0 @@
-#!/usr/bin/env python3
-import argparse
-import json
-import os
-import subprocess
-
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('path')
-    parser.add_argument('out', type=argparse.FileType('w'))
-    args = parser.parse_args()
-
-    os.chdir(os.path.expanduser(args.path))
-    git_show_cmd = 'git show -s --format=\'{"ref": "%D", "sha": "%H","author": "%an <%ae>","date":"%ad","commit_message": "%s"}\' HEAD'
-    output = subprocess.getoutput(git_show_cmd)
-    print(f'git output: {output}')
-    git_info = json.loads(output)
-
-    refname = os.environ['GIT_REF']
-    # refname = git_info['ref']
-    commit = git_info['sha']
-    author = git_info['author']
-    summary = git_info['commit_message']
-
-    scm_data = f'''Git info:
-    refname: {refname}
-    Commit: {commit}
-    Author: {author}
-    Summary: {summary}    
-'''
-
-    vcs_info = {
-        'BRANCH': refname,
-        'SCM_DATA': scm_data,
-        'PROGRAM_VERSION': scm_data
-    }
-
-    json.dump(vcs_info, args.out, indent=4)
-
-
-if __name__ == '__main__':
-    main()

+ 1 - 1
.github/workflows/docker_publish.yml

@@ -9,7 +9,7 @@ on:
         type: string
         required: true
         default: main
-        description: "Git branch/tag/sha revision to build"
+        description: "Git branch/tag revision to build"
       image_tag:
         type: string
         required: true