Commit 0fb622ec authored by eric pellegrini's avatar eric pellegrini

Improved git branch guess when working on detached state

parent 49635868
......@@ -134,7 +134,7 @@ ci:osx:
stage: ci
script:
- source ${CI_PROJECT_DIR}/BuildServer/Unix/MacOS/definitions.sh
- source ${CI_PROJECT_DIR}/BuildServer/Unix/version.sh
- source ${CI_PROJECT_DIR}/BuildServer/Unix/setup_ci.sh
- ${CI_PROJECT_DIR}/BuildServer/Unix/build.sh
- ${CI_PROJECT_DIR}/BuildServer/Unix/tests.sh
allow_failure: false
......@@ -150,7 +150,7 @@ deploy:osx:
stage: deploy
script:
- source ${CI_PROJECT_DIR}/BuildServer/Unix/MacOS/definitions.sh
- source ${CI_PROJECT_DIR}/BuildServer/Unix/version.sh
- source ${CI_PROJECT_DIR}/BuildServer/Unix/setup_ci.sh
- ${CI_PROJECT_DIR}/BuildServer/Unix/MacOS/deploy.sh
dependencies:
- ci:osx
......@@ -178,7 +178,7 @@ ci:windows:
stage: ci
script:
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\definitions.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\version.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\setup_ci.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\build.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\tests.bat"
allow_failure: false
......@@ -194,7 +194,7 @@ deploy:windows:
stage: deploy
script:
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\definitions.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\version.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\setup_ci.bat"
- call "%CI_PROJECT_DIR%\\BuildServer\\Windows\\deploy.bat"
dependencies:
- ci:windows
......
......@@ -4,15 +4,13 @@ SHELL ["/bin/bash", "-c"]
ARG MDANSE_GIT_COMMIT
ARG MDANSE_GIT_BRANCH_NAME
RUN GIT_SSL_NO_VERIFY=true git clone https://code.ill.fr/scientific-software/mdanse.git
WORKDIR mdanse
RUN git checkout ${MDANSE_GIT_COMMIT}
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/tests.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/tests.sh
......@@ -2,10 +2,8 @@ FROM ci_mdanse_bionic
SHELL ["/bin/bash", "-c"]
ARG MDANSE_GIT_BRANCH_NAME
VOLUME builds
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/deploy_debian.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/Debian/deploy.sh
......@@ -12,7 +12,7 @@ WORKDIR mdanse
RUN git checkout ${MDANSE_GIT_COMMIT}
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/tests.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/tests.sh
......@@ -2,10 +2,8 @@ FROM ci_mdanse_trusty
SHELL ["/bin/bash", "-c"]
ARG MDANSE_GIT_BRANCH_NAME
VOLUME builds
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/deploy_debian.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/Debian/deploy.sh
......@@ -4,15 +4,13 @@ SHELL ["/bin/bash", "-c"]
ARG MDANSE_GIT_COMMIT
ARG MDANSE_GIT_BRANCH_NAME
RUN GIT_SSL_NO_VERIFY=true git clone https://code.ill.fr/scientific-software/mdanse.git
WORKDIR mdanse
RUN git checkout ${MDANSE_GIT_COMMIT}
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/build.sh
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/tests.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/tests.sh
......@@ -2,10 +2,8 @@ FROM ci_mdanse_xenial
SHELL ["/bin/bash", "-c"]
ARG MDANSE_GIT_BRANCH_NAME
VOLUME builds
RUN source ./BuildServer/Unix/definitions_debian.sh ${MDANSE_GIT_BRANCH_NAME}; source ./BuildServer/Unix/version.sh ; ./BuildServer/Unix/deploy_debian.sh
RUN source ./BuildServer/Unix/Debian/definitions.sh; source ./BuildServer/Unix/setup_ci.sh ; ./BuildServer/Unix/Debian/deploy.sh
......@@ -26,7 +26,10 @@ export CI_COMMIT_ID=${CI_COMMIT_ID:0:8}
# Get commit branch from Gitlab
if [ -z ${CI_COMMIT_REF_NAME} ]; then
export CI_COMMIT_REF_NAME=$(git rev-parse --abbrev-ref HEAD)
CI_COMMIT_REF_NAME=$(git show -s --pretty=%d HEAD)
CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME:2:-1}
CI_COMMIT_REF_NAME=$(echo ${CI_COMMIT_REF_NAME} | rev | cut -d/ -f1 | rev)
export CI_COMMIT_REF_NAME
fi
export RED="\\033[1;31m"
......
#!/bin/bash
cd ${CI_PROJECT_DIR}
# Update the __pkginfo__ file with the current commit
echo -e "${BLUE}""Commit id = ${MDANSE_GIT_CURRENT_COMMIT}<--""${NORMAL}"
echo -e "${BLUE}""Branch name = ${MDANSE_GIT_BRANCH_NAME}<--""${NORMAL}"
$SED_I_COMMAND "s/.*__commit__.*/__commit__ = \"${MDANSE_GIT_CURRENT_COMMIT}\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
# Get MDANSE version
MDANSE_VERSION=`sed -n 's/__version__.*=.*\"\(.*\)\"/\1/p' ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py`
# Check if branch is master
if [[ ${MDANSE_GIT_BRANCH_NAME} == "master" ]]
then
VERSION_NAME=${MDANSE_VERSION}
$SED_I_COMMAND "s/.*__beta__.*/__beta__ = None/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
else
# Check if branch is release*
if [[ ${MDANSE_GIT_BRANCH_NAME::7} == "release" ]]
then
VERSION_NAME=${MDANSE_VERSION}-rc-${MDANSE_GIT_CURRENT_COMMIT}
$SED_I_COMMAND "s/.*__beta__.*/__beta__ = \"rc\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
else
VERSION_NAME=${MDANSE_VERSION}-beta-${MDANSE_GIT_CURRENT_COMMIT}
$SED_I_COMMAND "s/.*__beta__.*/__beta__ = \"beta\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
fi
fi
export VERSION_NAME
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment