Skip to content

GitLab CI Kotlin DSLopensavvy.gitlab.ciEnvironmenturl

url

fun url(url: String)

Declares the URL on which the deployed environment is available.

Example

val deploy-qa by job {
    script {
        // …
    }

    environment {
        name("qa")
        url("https://qa.your.app/dashboard")
    }
}

Example: dynamic URL

The URL can be generated by the job itself by combining this feature with Artifacts.dotenv:

val deploy-qa by job {
    script {
        shell("QA_URL=$(./generate-url) >>qa.env")
    }

    artifacts {
        dotenv("qa.env")
    }

    environment {
        name("qa")
        url($$"$QA_URL")
    }
}

External resources