Search code examples
grailscontinuous-integrationgitlab-cienvironment

I have a gitlab project that needs to run integration tests in different environments (Oracle etc), how can I change the environment


test:
  stage: test
  tags:
    - linux
    - docker
  script:
    - echo "testing"
    - ./grailsw "Oracledev test-app"
  artifacts:
    untracked: true
    name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_SHA"
    expire_in: 2 days
    when: always
  allow_failure: true

The environment name is oracledev, but the job is not able to set the environment to oracledev which is been defined in the Config.groovy file.


Solution

  • Grails has three pre-defined environments: dev, test, and prod. To run a command in these environments, you would use ./grailsw prod test-app.

    To specify any other custom environment for a Grails command you need to use a grails.env system property like so:

    ./grailsw -Dgrails.env=oracledev test-app
    

    You can read a little more about this in the Environments section of the docs.