cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI does not accept `instances "3"` as a property of deploymentNode

Open deinspanjer opened this issue 1 year ago • 2 comments

Using the instances keyword works fine in the online DSL editor as well as rendering in structurizr-lite and cloud, but if you try to push or validate using the CLI, it throws an error on that line.

The following DSL demonstrates the problem:

workspace "Testing issues with CLI and DSL include" {
    !identifiers hierarchical

    model {
        enterprise "An enterprise" {
            staff = person "An employee"
            g1 = softwareSystem "internal system A"
            sysB = softwareSystem "internal system B"
        }

        customer = person "A customer"

        extsys = softwareSystem "external system"

        !ref g1 {
            description "Is it broken?"
            tags "Internal"
            staff -> this "Uses"
            -> sysB "calls"
        }

        //!include deployments.dsl
        live = deploymentEnvironment "Live deployment" {
            dc = deploymentNode "Datacenter" {
                vpn = infrastructureNode "VPN Gateway"

                server1 = deploymentNode "Server 1" {
                    instances "3"
                    sysA = softwareSystemInstance g1
                }

                server2 = deploymentNode "Server 2" {
                    systemB = softwareSystemInstance sysB
                }
            }
        }

    }

}
% structurizr-cli validate -w workspace.dsl
Validating workspace at workspace.dsl
com.structurizr.dsl.StructurizrDslParserException: Unexpected tokens
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:744)
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:124)
	at com.structurizr.cli.AbstractCommand.loadWorkspace(AbstractCommand.java:59)
	at com.structurizr.cli.ValidateCommand.run(ValidateCommand.java:39)
	at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:38)
	at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:81)
com.structurizr.dsl.StructurizrDslParserException: Unexpected tokens at line 28: instances "3"
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:757)
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:124)
	at com.structurizr.cli.AbstractCommand.loadWorkspace(AbstractCommand.java:59)
	at com.structurizr.cli.ValidateCommand.run(ValidateCommand.java:39)
	at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:38)
	at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:81)

% structurizr-cli
Structurizr CLI v1.19.0
Structurizr DSL v1.19.1
Usage: structurizr push|pull|lock|unlock|export|validate|list [options]

deinspanjer avatar Aug 08 '22 18:08 deinspanjer

I was also investigating a separate issue I was having around referencing a softwareSystemInstance in structurizr-lite, and I might have discovered something related to this problem as well.

As described above, the CLI is using DSL v1.19.1. It looks like the structurizr/lite Docker image is using DSL v1.20.0:

% docker exec -t structurizr ls /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/
...
structurizr-dsl-1.20.0.jar
...

deinspanjer avatar Aug 08 '22 19:08 deinspanjer

Yeah, it looks like this was a feature raised in #133 of structurizr/dsl. Maybe the cli packages just need to be properly pushed out to Docker hub and to Homebrew?

deinspanjer avatar Aug 08 '22 19:08 deinspanjer

Yeah, it looks like this was a feature raised in #133 of structurizr/dsl. Maybe the cli packages just need to be properly pushed out to Docker hub and to Homebrew?

v1.20.0 has now been released.

simonbrowndotje avatar Aug 15 '22 13:08 simonbrowndotje