edbizarro / gitlab-ci-pipeline-php

:coffee: Docker images for test PHP applications with Gitlab CI (or any other CI platform!)
https://hub.docker.com/r/edbizarro/gitlab-ci-pipeline-php
MIT License
528 stars 166 forks source link

Permission denied for temp variable #87

Closed bhavicp closed 3 years ago

bhavicp commented 4 years ago

Hello,

I was using docker:latest as my image, however when I switch to yours, it seems to not even get into my workflow and errors with the below:

Running with gitlab-runner 12.8.0 (1b659122)
   on UK Digiops docker-runner Zdn4z1Dm
Using Docker executor with image edbizarro/gitlab-ci-pipeline-php:latest ...
 Starting service docker:dind ...
 Pulling docker image docker:dind ...
 Using docker image sha256:fe98abf5dda7ec569bc4821f20ceca66945e67882fe32f960fb8b8f179af0e42 for docker:dind ...
 Waiting for services to be up and running...
 *** WARNING: Service runner-Zdn4z1Dm-project-470-concurrent-0-docker-0 probably didn't start properly.
 Health check error:
 service "runner-Zdn4z1Dm-project-470-concurrent-0-docker-0-wait-for-service" timeout
 Health check container logs:
 Service container logs:
 2020-03-12T18:11:44.474068268Z Generating RSA private key, 4096 bit long modulus (2 primes)
 2020-03-12T18:11:47.211586637Z ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................++++
 2020-03-12T18:11:47.376305335Z ..........................++++
 2020-03-12T18:11:47.376782760Z e is 65537 (0x010001)
 2020-03-12T18:11:47.413970695Z Generating RSA private key, 4096 bit long modulus (2 primes)
 2020-03-12T18:11:47.644222179Z ......................++++
 2020-03-12T18:11:48.093315675Z ................................................................++++
 2020-03-12T18:11:48.093773687Z e is 65537 (0x010001)
 2020-03-12T18:11:48.131170790Z Signature ok
 2020-03-12T18:11:48.131198053Z subject=CN = docker:dind server
 2020-03-12T18:11:48.131413653Z Getting CA Private Key
 2020-03-12T18:11:48.148231755Z /certs/server/cert.pem: OK
 2020-03-12T18:11:48.152752841Z Generating RSA private key, 4096 bit long modulus (2 primes)
 2020-03-12T18:11:48.591170063Z ......................................................................++++
 2020-03-12T18:11:49.065700279Z ...............................................................................++++
 2020-03-12T18:11:49.066202036Z e is 65537 (0x010001)
 2020-03-12T18:11:49.097271386Z Signature ok
 2020-03-12T18:11:49.097297924Z subject=CN = docker:dind client
 2020-03-12T18:11:49.097499675Z Getting CA Private Key
 2020-03-12T18:11:49.115166049Z /certs/client/cert.pem: OK
 2020-03-12T18:11:49.119825599Z mount: permission denied (are you root?)
 2020-03-12T18:11:49.119857745Z Could not mount /sys/kernel/security.
 2020-03-12T18:11:49.119863915Z AppArmor detection and --privileged mode might break.
 2020-03-12T18:11:49.121341024Z mount: permission denied (are you root?)
 *********
 Pulling docker image edbizarro/gitlab-ci-pipeline-php:latest ...
 Using docker image sha256:3af3fd2cc6b518e476067813c9ea9103ecdfa3bf3cf63a0ea93dc6b9945ba238 for edbizarro/gitlab-ci-pipeline-php:latest ...
Running on runner-Zdn4z1Dm-project-470-concurrent-0 via invldnvldigops1...
00:07
Fetching changes with git depth set to 1...
00:03
 Reinitialized existing Git repository in /builds/microsites/ahead-of-the-curve/.git/
 From http://<repo>/microsites/ahead-of-the-curve
  * [new ref]         refs/pipelines/24402 -> refs/pipelines/24402
 Checking out 95705a20 as staging...
 Skipping Git submodules setup
/bin/bash: line 101: /builds/microsites/ahead-of-the-curve.tmp/EXCLUDE_FILESs: Permission denied
00:02
 ERROR: Job failed: exit code 1

I have a Gitlab variable named "EXCLUDE_FILESs" set to a file type. This works fine with the docker:latest image, but I've been looking for an image with PHP which supports wordpress-cli which yours seems to do, but I can't use it!

Part of my gitlab-ci if it helps


image: edbizarro/gitlab-ci-pipeline-php:latest
services:
  - docker:dind

stages:
  - prep
  - build
  - release
  - deploy

workflow:
  rules:
    # Don't run anything if branch ends in: -wip
    - if: $CI_COMMIT_REF_NAME =~ /-wip$/
      when: never
    - when: always

variables:
    SCRIPTS_REPO: http://$SCRIPTS_USER:$SCRIPTS_TOKEN@repo.com/microsites/ci-scripts.git

## Variables which need to be created in the project
## $DockerRegistryUser
## $DockerRegistryKey

before_script:
  - echo "updating"
  - apk update && apk add --no-cache git openssh-client rsync curl
    # Setup SSH deploy keys
  - eval $(ssh-agent -s)
  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config && chmod 600 ~/.ssh/config'
    # Setup our microsite deploy scripts
  - export SCRIPTS_DIR=$(mktemp -d) && git clone -q --depth 1 "$SCRIPTS_REPO" "$SCRIPTS_DIR" && chmod -R +x "$SCRIPTS_DIR"

install:
  stage: prep
  tags:
    - microsite
  script:
    - curl -k -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar
    - mv wp-cli.phar /usr/bin/wp
    - mkdir new && cd new/; wp core download --allow-root```
edbizarro commented 4 years ago

Have u tried clear the pipeline cache?

bhavicp commented 4 years ago

Hello,

Yes I have tried clearing the cache and running the pipeline, but it fails the same with. This includes even updating the variable name to something new, running it fresh, it does the same thing.

edbizarro commented 4 years ago

hi @bhavicp have you manage to figure out whats is the problem?