-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e8554b
commit 0f19288
Showing
13 changed files
with
264 additions
and
26 deletions.
There are no files selected for viewing
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
62 changes: 62 additions & 0 deletions
62
...ce/src/test/java/net/nemerosa/ontrack/kdsl/acceptance/tests/provisioning/ProvisionDemo.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package net.nemerosa.ontrack.kdsl.acceptance.tests.provisioning | ||
|
||
import net.nemerosa.ontrack.kdsl.acceptance.tests.AbstractACCDSLTestSupport | ||
import net.nemerosa.ontrack.kdsl.spec.admin.admin | ||
import net.nemerosa.ontrack.kdsl.spec.extension.environments.environments | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Test | ||
|
||
class ProvisionDemo : AbstractACCDSLTestSupport() { | ||
|
||
companion object { | ||
const val PRODUCT_A = "productA" | ||
|
||
const val ENV_STAGING = "staging" | ||
const val ENV_PRODUCTION = "production" | ||
|
||
const val BRONZE = "BRONZE" | ||
const val SILVER = "SILVER" | ||
const val GOLD = "GOLD" | ||
} | ||
|
||
@Test | ||
@Disabled | ||
fun `Provision environments`() { | ||
// Cleanup | ||
ontrack.findProjectByName(PRODUCT_A)?.delete() | ||
ontrack.environments.findEnvironmentByName(ENV_STAGING)?.delete() | ||
ontrack.environments.findEnvironmentByName(ENV_PRODUCTION)?.delete() | ||
|
||
// Predefined promotion levels | ||
ontrack.admin.predefinedPromotionLevels.apply { | ||
createPredefinedPromotionLevel( | ||
name = BRONZE, | ||
image = ProvisionDemo::class.java.getResource("/promotions/bronze.png"), | ||
override = true, | ||
) | ||
createPredefinedPromotionLevel( | ||
name = SILVER, | ||
image = ProvisionDemo::class.java.getResource("/promotions/silver.png"), | ||
override = true, | ||
) | ||
createPredefinedPromotionLevel( | ||
name = GOLD, | ||
image = ProvisionDemo::class.java.getResource("/promotions/gold.png"), | ||
override = true, | ||
) | ||
} | ||
|
||
// Project provisioning | ||
val project = ontrack.createProject(PRODUCT_A, "Project which can be deployed into an environment") | ||
val branch = project.branch("main") { this } | ||
val bronze = branch.promotion(BRONZE) | ||
val silver = branch.promotion(SILVER) | ||
val gold = branch.promotion(GOLD) | ||
|
||
// Creating the environments | ||
val envStaging = ontrack.environments.createEnvironment(ENV_STAGING, 100) | ||
val envProduction = ontrack.environments.createEnvironment(ENV_PRODUCTION, 200) | ||
|
||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...src/test/java/net/nemerosa/ontrack/kdsl/acceptance/tests/provisioning/README.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
These tests are disabled by default but can be used individually to provision | ||
any environment for demo purposes. |
7 changes: 7 additions & 0 deletions
7
...net/nemerosa/ontrack/kdsl/connector/graphql/schema/environments/DeleteEnvironment.graphql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mutation DeleteEnvironment($id: String!) { | ||
deleteEnvironment(input: { | ||
id: $id | ||
}) { | ||
...PayloadUserErrors | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...nemerosa/ontrack/kdsl/connector/graphql/schema/environments/FindEnvironmentByName.graphql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query FindEnvironmentByName($name: String!) { | ||
environmentByName(name: $name) { | ||
...EnvironmentFragment | ||
} | ||
} |
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
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
7 changes: 7 additions & 0 deletions
7
ontrack-kdsl/src/main/java/net/nemerosa/ontrack/kdsl/connector/FileContent.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.nemerosa.ontrack.kdsl.connector | ||
|
||
data class FileContent( | ||
val name: String, | ||
val content: ByteArray, | ||
val type: String, | ||
) |
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
Oops, something went wrong.