Ilkin Mehdiyev
Ilkin Mehdiyev

Reputation: 107

My Gitlab CI/CD pipeline failing in cache with FATAL: file does not exist error

right now I'm trying to learn CI/CD with Gradle. I'm using GitLab CI's pipeline. With a Gitlab documentation and a little bit search found gilab-ci.yml like this

image: gradle:jdk11

before_script:
  - export GRADLE_USER_HOME='pwd'/.gradle

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

package:
  stage: build
  script:
    - ./gradlew assemble

test:
  stage: test
  script:
    - ./gradlew check

However its not working for my Spring boot application Gitlab pipline gives me "FATAL: file does not exist" error. I'm thinking its due to caching but everything seems okay in YAML file

Upvotes: 8

Views: 11231

Answers (1)

Krishan Viduranga
Krishan Viduranga

Reputation: 401

Even though "FATAL: file does not exist" is red and bold, it is not failing the build but is just a warning. The actual cause of the failure is a couple of lines below: /bin/bash: line 104: ./gradlew: Permission denied.

To resolve the issue, update the build stage with the following code segment:

package:
 stage: build
 script:
  - chmod +x ./gradlew
  - ./gradlew --build-cache assemble

Upvotes: 16

Related Questions