Does anyone have any experience of using commandbo...
# box-products
a
Does anyone have any experience of using commandbox (and textbox) as part of a Bitbucket pipeline ? I can get it running fine in an Azure Devops pipeline but, in Bitbucket, I just get a 404 when it tries to run the tests. The YAML file is pretty basic:
Copy code
image: ortussolutions/commandbox:lucee5-alpine

pipelines:
  default:
    - step:
        name: Test
        script:
          - box install production=true && box server start
          - box testbox run outputFile=./test-reports/junit.xml reporter=junit
and the log shows that lucee is up and running but the textbox run line comes back with:
Copy code
Executing tests <http://localhost:8080/test/index.cfm?report_format=testbox.system.reports.TextReporter&recurse=true&reporter=junit&verbose=false> please wait...

ERROR (5.6.1+00618)

Error executing tests:404 Not Found   

 Lucee 5.3.9.160 Error (missinginclude) 

Message Page /test/index.cfm [/app/test/index.cfm] not found 

Mapping / 

Java Stacktrace lucee.runtime.exp.MissingIncludeException: Page /test/index.cfm [/app/test/index.cfm] not found
The line runs fine when I run it inside my local docker container which is running the same code, so I can only assume there is something in box.json and/or server.json that is confusing the pipeline; for example, there is no 'app' folder in the code base (but it is the working directory in the docker container)
z
I run testbox and lucee using the following approach (no webserver) https://github.com/lucee/script-runner#as-a-bitbucket-pipeline
👀 1
That is a pretty quick easy overview of it from @mborn
a
@Patrick that was what I used to get started and in the main it works fine. Which leads me down the path of it's something in my box/server.json file(s)
p
Could be that or something with your root mapping seems like it cant find that path or aka what your main / resides
a
@zackster really stupid question but ... do you literally just put that in the bitbucket-pipelines.yaml file ? Do you need to add anything to your Lucee code and/or change anything in the YAML to be specific to your Lucee code ?
z
yeah it's pretty much that simple
the executeScriptByInclude is important, otherwise it won't pick up any Application.cfc https://github.com/lucee/script-runner/blob/main/build-run-cfml.xml#L101
at which point it's basically no different to calling http://localhost/myscript.cfm
a
Thanks. I'll take a closer look at it later one but, my first tries, are just erroring out with stuff like unknown cf tag (cfimage) ?? My current YAML file contains:
Copy code
image: atlassian/default-image:3

pipelines:
  default:
    - step:
        name: Checkout Lucee Script-runner, Lucee and run tests
        script:
          - git clone <https://github.com/lucee/script-runner>
          - git clone <https://github.com/lucee/lucee>
          - ant -buildfile script-runner/build.xml -DluceeVersion="light-6.0.0.152-SNAPSHOT" -DexecuteScriptByInclude="true" -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -Dexecute="/bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/test"
If I include the first step then it errors on the first step with a "build.xml" file doesn't exist 😞 All I want it to do is checkout my code and do the same as what going to http://localhost:8080/test/, on local machine, does
z
ah, with script-runner there is no webserver
the pathing can be weird, add these lines after the
Copy code
- git clone <https://github.com/lucee/lucee>
to debug it - ls $BITBUCKET_CLONE_DIR -lR -maxdepth 2 - find -maxdepth 2 -ls
a
OK, so the first line errors out with "invalid option" for the ls command. However, just using ls shows that I am in the root level of my code base (which now has additional script-runner and lucee sub-folders) in which tests is at the same level as script-runner and lucee
z
the cfimage is due to light-6.0.0.152-SNAPSHOT, try 6.0.0.152-SNAPSHOT, or better what ever version you are using in prod, like 5.3.9.166
lucee light has no extensions
a
That makes a lot of sense - completely forgot about Lucee and it's extensions; am more a ACF man 🙂
z
i originally built this mainly so we could test the extensions in isolation (to elimate cross dependencies)
and so i can quickly compile / test / debug / work on extensions locally just by using this batch script
call ant
if %errorlevel% neq 0 exit /b %errorlevel%
set testLabels=orm
set testAdditional=C:\work\lucee-extensions\extension-hibernate\tests
ant -buildfile="C:\work\script-runner" -DluceeVersion="light-6.0.0.298-SNAPSHOT" -Dwebroot="C:\work\lucee6\test" -Dexecute="/bootstrap-tests.cfm" -DextensionDir="C:\work\lucee-extensions\extension-hibernate\dist" -DextensionDir="C:\work\lucee-extensions\extension-hibernate\dist"