GitlabCI specify repo url and branch also without merge request

This commit is contained in:
Gioacchino Mazzurco 2020-04-20 15:46:11 +02:00
parent 75082d7ca8
commit e2491b5f19
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -12,14 +12,17 @@ build-and-test:
script: script:
- > - >
if [ -n "$CI_MERGE_REQUEST_ID" ]; then if [ -n "$CI_MERGE_REQUEST_ID" ]; then
MR_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ; REPO_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ;
MR_ARGS="$MR_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ; REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ;
export MR_ARGS ; else
echo MR_ARGS=$MR_ARGS ; REPO_ARGS="--build-arg REPO_URL=$CI_REPOSITORY_URL" ;
fi REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_COMMIT_BRANCH" ;
fi ;
export REPO_ARGS ;
echo REPO_ARGS=$REPO_ARGS ;
- mkdir Dockercontext - mkdir Dockercontext
- > - >
docker build -t retroshare:testing $MR_ARGS docker build -t retroshare:testing $REPO_ARGS
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile --file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile
Dockercontext Dockercontext
- > - >