dockerherokucertificategitlab-ciheroku-cli

certificate has expired issue by deploying docker image to Heroku from gitlab


I've created an app on Heroku and I've been able to to deploy my Spring Boot dockerized application with heroku CLI from my machine.

However, when I try to perform the same actions from gitlab ci I've got an error on the last command. Everyhing before this command is working (the login to heroku, the push of the built image).

Here's my .gitlab-ci.yml file :

image: docker:latest

stages:
  - build
  - deploy

maven-build-application:
  stage: build
  image: maven:3-jdk-11
  script:
    - mvn clean package -DskipTests
  artifacts:
    paths:
      - target/*.jar

docker-build-and-deploy-application:
  stage: deploy
  image: rizkimufrizal/docker-node
  services:
    - docker:dind
  script:
    - npm install -g heroku
    - heroku container:login
    - heroku container:push web --app this-is-the-name-of-my-application
   # Here is the problem
    - heroku container:release web --app this-is-the-name-of-my-application

Output logs from my gitlab job :

latest: digest: sha256:62555048c6df008140c4720fc9fa0787caf2ef547a6c9d6e2608d3ba6c6e5dfa 
size: 953Your image has been successfully pushed. You can now release it with the 
'container:release' command.
$ heroku container:release web --app this-is-the-name-of-my-application
 ▸    CERT_HAS_EXPIRED: certificate has expired
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

I've made some research online but I can't find somehing on it, and I don't know what could I try ?

Maybe because the command is made inside a docker, I have to install intermediate certifcates ?

Thank you for your help

Antoine


Solution

  • Here's my updated final stage to deploy on heroku :

    docker-build-and-deploy-application:
      stage: deploy
      image: docker:latest
      services:
        - docker:dind
      before_script:
        - apk add nodejs npm
      script:
        - npm install -g heroku
        # Set the environemnet variable "HEROKU_API_KEY"
        # Get this token by running these commands :
        # #1 heroku login -i (write heroku username and password)
        # #2 heroku authorizations:create
        - heroku container:login
        # container:push web is going to build the docker image locally using the Dockerfile and push it to the repo
        - heroku container:push web --app this-is-the-name-of-my-application
        # container:release web is going to use the image pushed to deploy it
        - heroku container:release web --app this-is-the-name-of-my-application