Last active
August 26, 2019 01:32
-
-
Save apemberton/19dfe5083ffebcbcadaa5f902653643e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package _Self.buildTypes | |
import jetbrains.buildServer.configs.kotlin.v2018_2.* | |
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.script | |
object CasesApp : BuildType({ | |
name = "Cases App" | |
allowExternalStatus = true | |
maxRunningBuilds = 1 | |
params { | |
param("env.ProbeEnvironmentURL", "https://wwdt-tst.outsystemsenterprise.com") | |
param("env.LifeTimeAPIVersion", "2") | |
param("env.LifeTimeEnvironmentURL", "wwdt-lt.outsystemsenterprise.com") | |
param("TriggeredBy", "teamcity") | |
param("env.BddEnvironmentURL", "https://wwdt-tst.outsystemsenterprise.com") | |
param("env.AuthorizationToken", "ENTER_YOUR_OWN_AUTHORIZATION_TOKEN") | |
param("env.AcceptanceEnvironment", "Testing") | |
param("ApplicationScope", "Cases") | |
param("env.DevelopmentEnvironment", "Development") | |
param("env.ProductionEnvironment", "Production") | |
param("env.ArtifactsFolder", "Artifacts") | |
param("ApplicationScopeWithTests", "Cases,Cases_Tests") | |
} | |
vcs { | |
root(HttpsGithubComApembertonCasesPipelineTeamcityGit) | |
} | |
steps { | |
script { | |
name = "Prepare" | |
scriptContent = """ | |
echo "Create Artifacts Folder" | |
sudo mkdir ${'$'}{ArtifactsFolder} | |
// TODO install dependencies; these should be in Docker base image | |
sudo add-apt-repository ppa:deadsnakes/ppa -y && sudo apt-get update | |
sudo apt-get install -y python3-pip | |
// Only the virtual environment needs to be installed at the system level | |
echo "Install Python Virtual environments" | |
sudo pip3 install -q -I virtualenv | |
// Install the rest of the dependencies | |
echo "Install Python requirements" | |
sudo pip3 install -U outsystems-pipeline | |
""".trimIndent() | |
} | |
script { | |
name = "Staging to QA" | |
scriptContent = """ | |
echo "Pipeline run triggered remotely by '%TriggeredBy%' for the following applications (including tests): '%ApplicationScopeWithTests%'" | |
echo 'Retrieving latest application tags from Development environment...' | |
sudo python3 -m outsystems.pipeline.fetch_lifetime_data --artifacts "${'$'}ArtifactsFolder" --lt_url ${'$'}LifeTimeEnvironmentURL --lt_token ${'$'}AuthorizationToken --lt_api_version ${'$'}LifeTimeAPIVersion | |
echo 'Deploying latest application tags to Regression...' | |
sudo python3 -m outsystems.pipeline.deploy_latest_tags_to_target_env --artifacts "${'$'}ArtifactsFolder" --lt_url ${'$'}LifeTimeEnvironmentURL --lt_token ${'$'}AuthorizationToken --lt_api_version ${'$'}LifeTimeAPIVersion --source_env "${'$'}DevelopmentEnvironment" --destination_env "${'$'}AcceptanceEnvironment" --app_list "%ApplicationScopeWithTests%" | |
""".trimIndent() | |
} | |
script { | |
name = "Run Regression" | |
scriptContent = """ | |
echo 'Generating URLs for BDD testing...' | |
sudo python3 -m outsystems.pipeline.generate_unit_testing_assembly --artifacts "${'$'}ArtifactsFolder" --app_list "%ApplicationScopeWithTests%" --cicd_probe_env ${'$'}ProbeEnvironmentURL --bdd_framework_env ${'$'}BddEnvironmentURL | |
echo "Testing the URLs and generating the JUnit results XML..." | |
sudo python3 -m outsystems.pipeline.evaluate_test_results --artifacts "${'$'}ArtifactsFolder" | |
""".trimIndent() | |
} | |
script { | |
name = "Accept Changes" | |
scriptContent = "echo 'Accept Changes: not yet support in TeamCity'" | |
} | |
script { | |
name = "Deploy to Production" | |
scriptContent = """ | |
echo 'Deploying latest application tags to Production...' | |
python3 -m outsystems.pipeline.deploy_latest_tags_to_target_env --artifacts "${'$'}ArtifactsFolder" --lt_url ${'$'}LifeTimeEnvironmentURL --lt_token ${'$'}AuthorizationToken --lt_api_version ${'$'}LifeTimeAPIVersion --source_env "${'$'}AcceptanceEnvironment" --destination_env "${'$'}ProductionEnvironment" --app_list "%ApplicationScope%" | |
""".trimIndent() | |
} | |
} | |
features { | |
feature { | |
type = "xml-report-plugin" | |
param("xmlReportParsing.reportType", "junit") | |
param("xmlReportParsing.reportDirs", "Artifacts/junit-result.xml") | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment