Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variable support for Iroha image tag in CI workflow #444

Merged
merged 17 commits into from
Nov 8, 2024
Merged
1 change: 1 addition & 0 deletions .github/workflows/iroha2-allure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
required: false

env:
IROHA_IMAGE_TAG: "dev"
ALLURE_RESULTS: "${{ github.workspace }}/modules/client/build/allure-results"
ALLURE_JOB_RUN_ID: ${{ github.event.inputs.ALLURE_JOB_RUN_ID }}

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/iroha2-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
jobs:
build:
runs-on: self-hosted

env:
IROHA_IMAGE_TAG: "2.0.0-pre-rc.22.2" # Place "dev" to run on the last iroha

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ open class IrohaContainer : GenericContainer<IrohaContainer> {
private fun String.readStatusBlocks() = JSON_SERDE.readTree(this).get("blocks")?.doubleValue()

companion object {
private fun IrohaConfig.getFullImageName() = when (this.imageTag.contains("sha256")) {
true -> "${this.imageName}@${this.imageTag}"
false -> "${this.imageName}:${this.imageTag}"
}.let { DockerImageName.parse(it) }
private fun IrohaConfig.getFullImageName(): DockerImageName {
val imageTag = System.getenv("IROHA_IMAGE_TAG") ?: DEFAULT_IMAGE_TAG
return when (imageTag.contains("sha256")) {
true -> "${this.imageName}@$imageTag"
false -> "${this.imageName}:$imageTag"
}.let { DockerImageName.parse(it) }
}

const val NETWORK_ALIAS = "iroha"
const val DEFAULT_IMAGE_TAG = "2.0.0-pre-rc.22.2"
Expand Down
Loading