structurizr / cli

A command line utility for Structurizr.
https://docs.structurizr.com/cli
Apache License 2.0
492 stars 75 forks source link

Provide examples for continous integration #97

Closed Kaligule closed 1 year ago

Kaligule commented 1 year ago

I tried to get structurizr/cli working in an gitlab-ci for quite some time now. This is the best I could do, and it is not great (because it redoes a lot of the work that you already do in the Dockerfile, but I just couldn't get that one to work):

structurizr_export:
  image: eclipse-temurin:17.0.5_8-jre-jammy
  stage: generate_views
  before_script:
    - wget https://static.structurizr.com/download/structurizr-cli.zip
    - apt update && apt install unzip
    - unzip structurizr-cli.zip
  script:
    - bash structurizr.sh export --workspace my_workspace_file.dsl --format mermaid
    - ls -la
Kaligule commented 1 year ago

Got it to work, the trick was to overwrite the entrypoint. This is what I use now:

generate_views:
  stage: generate_views
  image:
    name: structurizr/cli
    entrypoint: [""]
  script:
    - /usr/local/structurizr-cli/structurizr.sh export --workspace workspace.dsl --format mermaid
    - ls -lah
  artifacts:
    paths:
      - "*.mmd"
    expire_in: 1 day
Kaligule commented 1 year ago

I still think it would be valuable to provide examples for gitlab and github in the documentation. My personal usecase is solved though.

simonbrowndotje commented 1 year ago

I still think it would be valuable to provide examples for gitlab and github in the documentation.

Glad you managed to resolve your issue. I don't use GitHub/GitLab for CI, but you're welcome to provide a PR with documentation.

Kaligule commented 1 year ago

Gladly. I even got a cool PR number: #100

Perhaps this is the right place to say thank you for your awesome work, both on C4 and on structurizr. I am a fan of diagramming tools, but structurizr's syntax is so cool and clear that I just can't go back. I am looking forward to seeing which directions the project will go.