package: gitlab-ci-multi-runner
version: 1.4.2+dfsg-1
severity: important

Hi.
If a job includes a cache, then it appears that the initial working
directory is  some directory inside the cache, *not* the top of the
project directory.

In trying to diagnose build failures I produced the following job:

install_test:
  dependencies:
    - snapshot_package
  stage: test
  variables:
    DEBIAN_FRONTEND: noninteractive
  cache:
    key: "$CI_BUILD_NAME"
    paths:
      - apt_cache
  script:
    - ' if [ -d apt_cache/cache ]; then cd apt_cache/cache&&tar cf - . | (cd 
/build/unstable/var/cache/apt&& tar xpf - ); fi'
    - 'if [ -d apt_cache/lists ]; then cd apt_cache/lists&&tar cf - . |( cd 
/build/unstable/var/lib/apt/lists && tar xpf - ) ; fi'
    - mkdir /build/unstable/sbuild_out
    - git status
    - pwd
    - env
    - ls apt_cache
    - cp sbuild_out/*.deb /build/unstable/sbuild_out
    - schroot --directory / -c unstable apt-get update
    - schroot --directory / -c unstable -- apt-get -y --allow-downgrades -o 
DPkg::Options::="--force-confold" install ./sbuild_out/*.deb
    - mkdir -p apt_cache
    - cp -a /build/unstable/var/cache/apt/. apt_cache/cache
    - cp -a /build/unstable/var/lib/apt/lists/. apt_cache/lists
  tags:
    - debian


And I get the following output:
[0KRunning with gitlab-ci-multi-runner dev (1.4.2)[0;m
[0;m[0KUsing Docker executor with image runner:latest ...
[0;m[0KPulling docker image runner:latest ...
[0;m[0;33mWARNING: Cannot pull the latest version of image runner:latest : 
Error: image library/runner not found
[0;m[0;33mWARNING: Locally found image will be used instead.
[0;mRunning on runner-99528d3b-project-1-concurrent-0 via gitlab-runner...
[32;1mFetching changes...[0;m
Removing sbuild_out/
HEAD is now at 84b1436 We're getting closer
[32;1mChecking out 84b14360 as master...[0;m
[32;1mChecking cache for install_test...[0;m
[32;1mDownloading artifacts for snapshot_package (150)...[0;m
Downloading artifacts from coordinator... ok      [0;m  id[0;m=150 
responseStatus[0;m=200 OK token[0;m=
[32;1m$ if [ -d apt_cache/cache ]; then cd apt_cache/cache&&tar cf - . | (cd 
/build/unstable/var/cache/apt&& tar xpf - ); fi[0;m
[32;1m$ if [ -d apt_cache/lists ]; then cd apt_cache/lists&&tar cf - . |( cd 
/build/unstable/var/lib/apt/lists && tar xpf - ) ; fi[0;m
[32;1m$ mkdir /build/unstable/sbuild_out[0;m
[32;1m$ git status[0;m
HEAD detached at 84b1436
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        ../
        ../../sbuild_out/

nothing added to commit but untracked files present (use "git add" to track)
[32;1m$ pwd[0;m
/builds/hadron/hadron-operations/apt_cache/cache
[32;1m$ env[0;m
CI_PROJECT_NAME=hadron-operations
CI_BUILD_TOKEN=
HOSTNAME=runner-99528d3b-project-1-concurrent-0
CI_PROJECT_URL=https://gitlab.hadronindustries.com/hadron/hadron-operations
CI_BUILD_BEFORE_SHA=84b143607c165d0dd2e9382d16b20764bc0402e6
CI_SERVER_VERSION=8.11.0
CI_BUILD_ID=151
OLDPWD=/builds/hadron/hadron-operations
CI_PROJECT_ID=1
CI_RUNNER_ID=2
CI_PIPELINE_ID=576
CI_BUILD_REF_NAME=master
CI_BUILD_REF=84b143607c165d0dd2e9382d16b20764bc0402e6
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CI_BUILD_STAGE=test
CI_PROJECT_DIR=/builds/hadron/hadron-operations
CI_RUNNER_TAGS=debian
PWD=/builds/hadron/hadron-operations/apt_cache/cache
CI_SERVER_NAME=GitLab
CI_PROJECT_PATH=hadron/hadron-operations
GITLAB_CI=true
CI_SERVER_REVISION=346e677
SHLVL=1
CI_BUILD_NAME=install_test
HOME=/root
CI_SERVER=yes
CI=true
CI_PROJECT_NAMESPACE=hadron
DEBIAN_FRONTEND=noninteractive
CI_BUILD_REPO=https://gitlab-ci-token:@gitlab.hadronindustries.com/hadron/hadron-operations.git
CI_RUNNER_DESCRIPTION=Debian Packaging Runner
_=/usr/bin/env
[32;1m$ ls apt_cache[0;m
ls: cannot access 'apt_cache': No such file or directory
[31;1mERROR: Build failed: exit code 1
[0;m

I can wor around this by changing to CI_PROJECT_DIR, but it seems fairly
clear that I'm starting in the wrong place.

_______________________________________________
Pkg-go-maintainers mailing list
Pkg-go-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers

Reply via email to