[Solved] Building dockerfile works in push event, but not in pull_request event

I have a weird issue where building my Dockerfile that’s inside the repository works with a push event, but not with a pull_request event.

This is the push event (which works):

-- CLONE PIPELINE:

+ git init
Initialized empty Git repository in /drone/src/github.com/paramander/myprivaterepo/.git/
+ git remote add origin https://github.com/paramander/myprivaterepo.git
+ git fetch --no-tags origin +refs/heads/test/suite:
From https://github.com/paramander/myprivaterepo
 * branch            test/suite -> FETCH_HEAD
 * [new branch]      test/suite -> origin/test/suite
+ git reset --hard -q 141b169324e8a3bfaf13663205eb6979fef942fd
+ git submodule update --init --recursive


-- BUILD PIPELINE:

+ docker build --rm -t myphp:latest .
Sending build context to Docker daemon  227.6MB

Step 1/3 : FROM php:7.1
 ---> 69e9da750e9c
Step 2/3 : RUN apt-get update && apt-get install -y         wget         libfreetype6-dev         libjpeg62-turbo-dev         libmcrypt-dev         libpng-dev     && docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql mbstring zip     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/     && docker-php-ext-install -j$(nproc) gd
 ---> Using cache
 ---> c2b1a3a044bb
Step 3/3 : RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet          mv composer.phar /usr/local/bin/composer
 ---> Using cache
 ---> e5863c1b3b5a
Successfully built e5863c1b3b5a
Successfully tagged myphp:latest

but when I open a Pull request on github, the build pipeline fails because of a symlink being in the path:

+ git init
Initialized empty Git repository in /drone/src/github.com/paramander/myprivaterepo/.git/
+ git remote add origin https://github.com/paramander/myprivaterepo.git
+ git fetch --no-tags origin +refs/pull/9/merge:
From https://github.com/paramander/myprivatrepo
 * branch            refs/pull/9/merge -> FETCH_HEAD
+ git checkout -qf FETCH_HEAD
+ git submodule update --init --recursive



+ docker build --rm -t myphp:latest .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /drone/src/github.com/paramander/myprivaterepo/Dockerfile: no such file or directory

what could be the cause of this? I simply don’t understand why the push event doesn’t have this issue, but the pull request event does.

I don’t think this is related to symlinks.

Are you sure the Dockerfile is present in the PR’s branch as well ?

@gboddin It seems I managed to mess up the merge ref of that pull request by using force pushes. It always pointed to the SHA of the original PR, and it seems it never changed to the new SHA (of the force push).