Isolated "Semantic-Release" docker container works, but takes 40 minutes in GitLab CI

Viewed 351

I have an isolated Gitlab server and Gitlab runner that lack internet connectivity. I am trying to run "semantic-versioning" (a node.js app) in a Docker container so that it can handle automatic versioning for my GitLab repositories.

I have to build all the dependencies into a Docker container in advanced since they cannot reach the internet during runtime, and I have to manually move the container over to the Gitlab Runner for a manual Docker load.

I have gotten through all the token issues and connected all the parts together, and I finally got a positive result (with a minor version bump), however it took 1660 seconds to run on a nearly empty repository (this repo is just for test).

The step that takes up the most time and where the process hangs is when "npx semantic-release" is executed. From there it can take up to 40 minutes to finish. However, once the npx semantic-release step finishes, the actual "work" of analyzing the repo takes just a few seconds. This makes me think it has something more to do with how the Dockerfile was prepped than a configuration issue with semantic-release itself.

This is the step below that is taking the longest:

$ npx semantic-release

npx: installed 575 in 1660.75s

Executing "step_script" stage of the job script
Using docker image sha256:d0733317abd6fbce07dcf85b1aff35d82f986e7de9ff56fdf5b985504bf3e9f4 for semantic:1 ...
$ npx semantic-release
npx: installed 575 in 1660.75s
[6:03:29 PM] [semantic-release] › ℹ  Running semantic-release version 17.4.4
[6:03:29 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[6:03:29 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[6:03:29 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[6:03:29 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/gitlab"
[6:03:29 PM] [semantic-release] › ✔  Run automated release from branch main on repository http://gitlab-ci-token:[secure]@[internal_IP]/gitlab-instance-937dde58/my_second_project.git
[6:03:30 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[6:03:30 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[6:03:30 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Verify GitLab authentication (http://[internal_IP]/api/v4)
[6:03:30 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/gitlab"
[6:03:30 PM] [semantic-release] › ℹ  Found git tag v1.0.0 associated with version 1.0.0 on branch main
[6:03:30 PM] [semantic-release] › ℹ  Found 32 commits since last release
[6:03:30 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[6:03:30 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: new stuff

Likely its my Dockerfile that needs further inspecting. However I am quite new at it and would need advice on whats taking so long (can I not have the dockerfile just pre-install the 575 dependencies for semantic-release in advance?)

Here is my Dockerfile (which I built as "semantic:1")

FROM node:13
RUN npm config set strict-ssl false
RUN npm install semantic-release@17.4.4
RUN npm install @semantic-release/gitlab@6.2.2

Here is my gitlab-ci.yml

--- 
release: 
  image: "semantic:1"
  only: 
    refs: 
      - main
      - alpha
      - "/^(([0-9]+)\\.)?([0-9]+)\\.x/"
      - "/^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$/"
  script: 
    - "npx semantic-release"
  stage: release
stages: 
  - release

and my .releaserc.yml

plugins:
  - "@semantic-release/commit-analyzer"
  - "@semantic-release/release-notes-generator"
  - "@semantic-release/gitlab"
branches:
  - "main"
  - "+([0-9])?(.{+([0-9]),x}).x"
  - name: "alpha"
    prerelease: "alpha"

Thank you!

1 Answers

Credit goes to this repo: https://github.com/caos/semantic-release

Basically just looked at that person's Dockerfile, and just added in strict versions so that there would be no searching for the latest update (since my setup is isolated).

FROM node:13
RUN npm config set strict-ssl false
RUN npm install -g semantic-release@17.4.5
RUN npm install -g @semantic-release/gitlab@6.2.2
RUN npm config set registry http://registry.npmjs.org/
ENTRYPOINT ["npx"]
CMD ["semantic-release@17.4.5"]

Cheers!

Related