remove need to mount .git directory as volume for Linters

refs DE-670

For the EKS transition, we need to ensure that the Linters stage doesn’t run on the EC2 builder node and instead properly uses EKS containers. To do this, the Linters stage needs to not depend on having the .git directory on the host machine.

Test Plan
1. Linters properly reports to the correct gerrit for main builds
2. Linters properly reports to the correct gerrit for plugin builds
3. Linters does not become the runtime bottleneck
4. Linters yarn.lock diff check works

Change-Id: I49650bfb3feece9614a667d3af5ec9dba8c2e838
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264539
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
Aaron Ogata 2021-05-10 11:08:52 -07:00
parent d8b3dcdac3
commit 2869b6e1cb
3 changed files with 17 additions and 3 deletions

View File

@ -0,0 +1,7 @@
FROM local/linters-runner
ARG DST_WORKDIR
ENV DST_WORKDIR=${DST_WORKDIR}
RUN mkdir -p ${DST_WORKDIR}
COPY --chown=docker:docker . ${DST_WORKDIR}

View File

@ -22,7 +22,6 @@ import groovy.transform.Field
def _getDockerInputs() {
def inputVars = [
"--volume $WORKSPACE/.git:/usr/src/app/.git",
'--env GERGICH_DB_PATH=/home/docker/gergich',
"--env GERGICH_PUBLISH=$GERGICH_PUBLISH",
"--env GERGICH_KEY=$GERGICH_KEY",
@ -39,7 +38,6 @@ def _getDockerInputs() {
if (env.GERRIT_PROJECT != 'canvas-lms') {
inputVars.addAll([
"--volume $WORKSPACE/gems/plugins/$GERRIT_PROJECT/.git:/usr/src/app/gems/plugins/$GERRIT_PROJECT/.git",
"--env GERGICH_GIT_PATH=/usr/src/app/gems/plugins/$GERRIT_PROJECT",
])
}

View File

@ -11,5 +11,14 @@ docker tag $WEBPACK_BUILDER_IMAGE local/webpack-builder
docker build \
--file Dockerfile.jenkins.linters-runner \
--label "WEBPACK_BUILDER_IMAGE=$WEBPACK_BUILDER_IMAGE" \
--tag "$1" \
--tag "local/linters-runner" \
"$WORKSPACE"
# The .git directory is ignored by .dockerignore, so we work around this by
# mounting the .git directory itself as the build context and copying it in.
docker build \
--build-arg DST_WORKDIR="$DOCKER_WORKDIR/.git" \
--file Dockerfile.jenkins.linters-final \
--label "WEBPACK_BUILDER_IMAGE=$WEBPACK_BUILDER_IMAGE" \
--tag "$1" \
"$LOCAL_WORKDIR/.git"