use DOCKER_WORKDIR for git safe.directory

hardcoding the dir /usr/src/app for git safe.directory doesn't
still leaves plugins broken. Change to use $DOCKER_WORKDIR.

flag: none

Test Plan:
- plugin jenkins build generates crystalball prediction
- standard jenkins build generates crystalball prediction

Change-Id: I06b3be6884685377fca3653f18db6a0a0157800d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/319114
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
Build-Review: James Butters <jbutters@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
This commit is contained in:
James Butters 2023-05-25 07:10:38 -06:00
parent eecdbc334b
commit 0e96f3b758
1 changed files with 3 additions and 2 deletions

5
Jenkinsfile vendored
View File

@ -436,10 +436,11 @@ pipeline {
docker exec -dt general-build-container bin/rails graphql:schema
'''
@SuppressWarnings('GStringExpressionWithinString')
def crystalballStep = '''
diffFrom=$(git --git-dir $LOCAL_WORKDIR/.git rev-parse $GERRIT_PATCHSET_REVISION^1)
# crystalball will fail without adding /usr/src/app to safe.directory
docker exec -t general-build-container bash -c 'git config --global --add safe.directory /usr/src/app'
# crystalball will fail without adding $DOCKER_WORKDIR to safe.directory
docker exec -t general-build-container bash -c "git config --global --add safe.directory ${DOCKER_WORKDIR%/}"
docker exec -dt \
-e CRYSTALBALL_DIFF_FROM=$diffFrom \
-e CRYSTALBALL_DIFF_TO=$GERRIT_PATCHSET_REVISION \