Skip to content
Snippets Groups Projects
Commit 2f8ece9b authored by rachid.yahiaoui's avatar rachid.yahiaoui
Browse files

update gitlab-ci

parent b3a7d36e
No related branches found
No related tags found
No related merge requests found
......@@ -33,57 +33,45 @@ build:
tags:
- stable
script:
- echo "Build Docker Image ( BRANCH = $CI_COMMIT_BRANCH )."
- echo "Build Docker Image ( BRANCH = $CI_COMMIT_REF_NAME / COMMIT_ID = $COMMIT_ID )."
- DOCKER_REGISTRY="$CI_REGISTRY/anaee-dev/coby"
## Create a TAG_ID based on the SHA COMMIT ID
- TAG_ID=$CI_COMMIT_SHORT_SHA # SHORT COMMIT ID.
- BRANCH_NAME="${CI_COMMIT_BRANCH}-"
- COMMIT_BRANCH="$CI_COMMIT_BRANCH"
- if [[ -n "$CI_COMMIT_TAG" ]] ; then
BRANCH_NAME="" ;
TAG_ID="$CI_COMMIT_TAG" ;
COMMIT_BRANCH="$CI_COMMIT_TAG" ;
fi
## Create a COMMIT_ID based on the SHA COMMIT ID
- COMMIT_ID=$CI_COMMIT_SHORT_SHA # SHORT COMMIT ID.
###########################################################
# Build Docker image ( with tag : <COMMIT-ID> ) and Push ##
###########################################################
- DOCKER_BUILDKIT=1 docker build -t $DOCKER_REGISTRY:${BRANCH_NAME}${TAG_ID} .
- docker push $DOCKER_REGISTRY:${BRANCH_NAME}${TAG_ID}
- docker tag $DOCKER_REGISTRY:${BRANCH_NAME}${TAG_ID} $DOCKER_REGISTRY:${BRANCH_NAME}
- docker push $DOCKER_REGISTRY:${BRANCH_NAME}
# Tag the Docker Release image with ( with tag : <latest> ) and Push - Only if Tagged Branch
- if [[ -n "$CI_COMMIT_TAG" ]] ; then
docker tag $DOCKER_REGISTRY:${BRANCH_NAME}${TAG_ID} $DOCKER_REGISTRY:latest ;
docker push $DOCKER_REGISTRY:latest ;
fi
- DOCKER_BUILDKIT=1 docker build -t $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}-${COMMIT_ID} .
- docker push $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}-${COMMIT_ID}
- docker tag $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}-${COMMIT_ID} $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}
- docker push $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}
# Copy the dir /opt/coby inside the container into build dir
- if [ "$(docker ps -aq -f name=coby_tmp)" ]; then docker rm -f coby_tmp; fi
- mkdir coby
- docker create -ti --name coby_tmp $DOCKER_REGISTRY:${BRANCH_NAME}${TAG_ID}
- docker cp coby_tmp:/opt/coby coby/build-$COMMIT_BRANCH
- docker cp coby_tmp:/opt/coby-src coby/src-$COMMIT_BRANCH
- docker create -ti --name coby_tmp $DOCKER_REGISTRY:${CI_COMMIT_REF_NAME}-${COMMIT_ID}
- docker cp coby_tmp:/opt/coby coby/build-$CI_COMMIT_REF_NAME
- docker cp coby_tmp:/opt/coby-src coby/src-$CI_COMMIT_REF_NAME
# README FILE
- touch coby/README.md
- |
echo "
## Copy S.I Dir ( Contains mapping files + Ontology )
cp -a src-$COMMIT_BRANCH/src/SI/. build-$COMMIT_BRANCH/pipeline/SI
cp -a src-$CI_COMMIT_REF_NAME/src/SI/. build-$CI_COMMIT_REF_NAME/pipeline/SI
## Copy Orchestrator Dir
cp -a src-$COMMIT_BRANCH/src/orchestrators/. build-$COMMIT_BRANCH/pipeline/orchestrators
cp -a src-$CI_COMMIT_REF_NAME/src/orchestrators/. build-$CI_COMMIT_REF_NAME/pipeline/orchestrators
## Run
## Orchestrator Mode, Synthesis Ex :
cd build-$COMMIT_BRANCH/pipeline/orchestrators
cd build-$CI_COMMIT_REF_NAME/pipeline/orchestrators
./coby.sh extract="SYNTHESIS" query=' SI = SI OBS FORET ALL'
## Orchestrator Mode, Data Ex :
cd build-$COMMIT_BRANCH/pipeline/orchestrators
cd build-$CI_COMMIT_REF_NAME/pipeline/orchestrators
./coby.sh login=admin extract='DATA' query=' SI = SI OBS FORET ALL & year = 2001 & CLASS = flux semi-horaire ' job='job-01'
## Server Mode
cd build-$COMMIT_BRANCH/jaxy-server
cd build-$CI_COMMIT_REF_NAME/jaxy-server
./run_server.sh # Query Ex, SI = SI OBS FORET ALL & year = 2001 & CLASS = flux semi-horaire
" >> coby/README.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment