[ 
https://issues.apache.org/jira/browse/MESOS-9605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16775775#comment-16775775
 ] 

Till Toenshoff commented on MESOS-9605:
---------------------------------------


During the configuration phase, we check for a git-repository artefact in the 
source root folder.
{noformat}
AM_CONDITIONAL([GIT_REPO], [test -d ${srcdir}"/.git"])
{noformat}

[https://github.com/apache/mesos/blob/36df6d9404e3ad5b7737ef56d85caf9562e126b5/configure.ac#L821]

During make, we then fetch the HEAD SHA by invoking the git command line tool.
{noformat}
if GIT_REPO
BUILD_GIT_SHA=$$(sh -c 'cd $(top_srcdir); \
  SHA=`git log -n 1 --format=%H 2> /dev/null` && \
  echo -DBUILD_GIT_SHA=\"$$SHA\"')
libbuild_la_CPPFLAGS += $(BUILD_GIT_SHA)
{noformat}
[https://github.com/apache/mesos/blob/36df6d9404e3ad5b7737ef56d85caf9562e126b5/src/Makefile.am#L1530-L1534]

As part of libmesos, we create a universally used GIT SHA constant.
{noformat}
#ifdef BUILD_GIT_SHA
const Option<string> GIT_SHA = string(BUILD_GIT_SHA);
#else
const Option<string> GIT_SHA = None();
#endif
{noformat}
[https://github.com/apache/mesos/blob/36df6d9404e3ad5b7737ef56d85caf9562e126b5/src/common/build.cpp#L58-L62]

...and then finally how our runnables log it like in the agent startup;
{noformat}
  if (build::GIT_SHA.isSome()) {
    LOG(INFO) << "Git SHA: " << build::GIT_SHA.get();
  }
{noformat}
[https://github.com/apache/mesos/blob/36df6d9404e3ad5b7737ef56d85caf9562e126b5/src/slave/main.cpp#L357-L358]

> mesos/mesos-centos nightly docker image has to include the SHA of the build.
> ----------------------------------------------------------------------------
>
>                 Key: MESOS-9605
>                 URL: https://issues.apache.org/jira/browse/MESOS-9605
>             Project: Mesos
>          Issue Type: Bug
>          Components: build
>            Reporter: Till Toenshoff
>            Priority: Minor
>              Labels: Mesosphere, Packaging, integration
>
> As a snapshot build, we need to identify the exact HEAD of the branch build. 
> Our current snapshot builds lack this information due to the way the build is 
> setup.
> The current build identifies e.g. when running the agent like this;
> {noformat}
> $ docker run -it docker.io/mesos/mesos-centos:master-2019-02-15 mesos-slave 
> --work_dir=/tmp --master=127.0.0.1:5050
> I0223 02:22:43.317088     1 main.cpp:349] Build: 2019-02-15 22:46:47 by
> I0223 02:22:43.317643     1 main.cpp:350] Version: 1.7.2
> I0223 02:22:43.332036     1 systemd.cpp:240] systemd version `219` detected
> I0223 02:22:43.332067     1 main.cpp:452] Initializing systemd state
> E0223 02:22:43.332135     1 main.cpp:461] EXIT with status 1: Failed to 
> initialize systemd: Failed to locate systemd runtime directory: 
> /run/systemd/system
> {noformat}
> Note we lack a user in the first output line and the GIT sha altogether. Only 
> tagged builds should commonly lack the SHA as it is not needed.
> {noformat}
> I0215 08:28:20.871155 34809 main.cpp:358] Git SHA: 
> dff75bb705dca473a5c4019d9ed6e2d3530e3865
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to