Skip to content

Commit

Permalink
Merge pull request #15959 from MinaProtocol/fix/network-id-develop
Browse files Browse the repository at this point in the history
Fix/network id develop
  • Loading branch information
dkijania authored Aug 29, 2024
2 parents 48888b0 + e81e748 commit 79f6a40
Show file tree
Hide file tree
Showing 21 changed files with 277 additions and 92 deletions.
6 changes: 4 additions & 2 deletions buildkite/src/Command/DockerImage.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ let Size = ./Size.dhall

let Profiles = ../Constants/Profiles.dhall

let Artifacts = ../Constants/Artifacts.dhall

let BuildFlags = ../Constants/BuildFlags.dhall

let Cmd = ../Lib/Cmds.dhall
Expand Down Expand Up @@ -42,7 +44,7 @@ let ReleaseSpec =
{ deps = [] : List Command.TaggedKey.Type
, network = "${Network.lowerName Network.Type.Devnet}"
, version = "\\\${MINA_DOCKER_TAG}"
, service = "\\\${MINA_SERVICE}"
, service = Artifacts.dockerName Artifacts.Type.Daemon
, branch = "\\\${BUILDKITE_BRANCH}"
, repo = "\\\${BUILDKITE_REPO}"
, deb_codename = "bullseye"
Expand All @@ -66,8 +68,8 @@ let generateStep =
let buildDockerCmd =
"./scripts/docker/build.sh"
++ " --service ${spec.service}"
++ " --version ${spec.version}"
++ " --network ${spec.network}"
++ " --version ${spec.version}"
++ " --branch ${spec.branch}"
++ " ${maybeCacheOption} "
++ " --deb-codename ${spec.deb_codename}"
Expand Down
8 changes: 5 additions & 3 deletions buildkite/src/Command/HardforkPackageGeneration.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ let DebianVersions = ../Constants/DebianVersions.dhall

let DebianRepo = ../Constants/DebianRepo.dhall

let Artifacts = ../Constants/Artifacts.dhall

let Profiles = ../Constants/Profiles.dhall

let Toolchain = ../Constants/Toolchain.dhall
Expand Down Expand Up @@ -157,7 +159,7 @@ let pipeline
DockerImage.ReleaseSpec::{
, deps =
[ { name = pipelineName, key = generateLedgersJobKey } ]
, service = "mina-daemon"
, service = Artifacts.dockerName Artifacts.Type.Daemon
, network = network_name
, deb_codename = "${DebianVersions.lowerName debVersion}"
, deb_profile = profile
Expand Down Expand Up @@ -212,7 +214,7 @@ let pipeline
DockerImage.ReleaseSpec::{
, deps =
[ { name = pipelineName, key = generateLedgersJobKey } ]
, service = "mina-archive"
, service = Artifacts.dockerName Artifacts.Type.Archive
, network = network_name
, deb_codename = "${DebianVersions.lowerName debVersion}"
, deb_profile = profile
Expand All @@ -226,7 +228,7 @@ let pipeline
DockerImage.ReleaseSpec::{
, deps =
[ { name = pipelineName, key = generateLedgersJobKey } ]
, service = "mina-rosetta"
, service = Artifacts.dockerName Artifacts.Type.Rosetta
, network = network_name
, deb_repo = DebianRepo.Type.Local
, deb_codename = "${DebianVersions.lowerName debVersion}"
Expand Down
119 changes: 64 additions & 55 deletions buildkite/src/Command/MinaArtifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -105,36 +105,6 @@ let build_artifacts
]
}

let publish_to_debian_repo =
\(spec : MinaBuildSpec.Type)
-> Command.build
Command.Config::{
, commands =
Toolchain.select
spec.toolchainSelectMode
spec.debVersion
[ "AWS_ACCESS_KEY_ID"
, "AWS_SECRET_ACCESS_KEY"
, "MINA_DEB_CODENAME=${DebianVersions.lowerName
spec.debVersion}"
, "MINA_DEB_RELEASE=${DebianChannel.lowerName spec.channel}"
]
"./buildkite/scripts/debian/publish.sh"
, label =
"Publish Mina for ${DebianVersions.capitalName
spec.debVersion} ${Profiles.toSuffixUppercase
spec.profile}"
, key = "publish-deb-pkg"
, depends_on =
DebianVersions.dependsOnStep
(Some spec.prefix)
spec.debVersion
spec.profile
spec.buildFlags
"build"
, target = Size.Small
}

let docker_step
: Artifacts.Type -> MinaBuildSpec.Type -> List DockerImage.ReleaseSpec.Type
= \(artifact : Artifacts.Type)
Expand All @@ -157,7 +127,8 @@ let docker_step
( \(n : Network.Type)
-> DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-daemon"
, service =
Artifacts.dockerName Artifacts.Type.Daemon
, network = Network.lowerName n
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
Expand All @@ -178,8 +149,8 @@ let docker_step
, BatchTxn =
[ DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-batch-txn"
, network = "${Network.lowerName Network.Type.Devnet}"
, service = Artifacts.dockerName Artifacts.Type.BatchTxn
, network = Network.lowerName Network.Type.Devnet
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
, deb_profile = spec.profile
Expand All @@ -188,13 +159,13 @@ let docker_step
, step_key =
"batch-txn-${DebianVersions.lowerName
spec.debVersion}${BuildFlags.toLabelSegment
spec.buildFlags}--docker-image"
spec.buildFlags}-docker-image"
}
]
, Archive =
[ DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-archive"
, service = Artifacts.dockerName Artifacts.Type.Archive
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
, deb_profile = spec.profile
Expand All @@ -208,25 +179,32 @@ let docker_step
}
]
, Rosetta =
[ DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-rosetta"
, network = "${Network.lowerName Network.Type.Devnet}"
, build_flags = spec.buildFlags
, deb_repo = DebianRepo.Type.Local
, deb_profile = spec.profile
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
, step_key =
"rosetta-${DebianVersions.lowerName
spec.debVersion}${BuildFlags.toLabelSegment
spec.buildFlags}-docker-image"
}
]
Prelude.List.map
Network.Type
DockerImage.ReleaseSpec.Type
( \(n : Network.Type)
-> DockerImage.ReleaseSpec::{
, deps = deps
, service =
Artifacts.dockerName Artifacts.Type.Rosetta
, network = Network.lowerName n
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
, deb_profile = spec.profile
, deb_repo = DebianRepo.Type.Local
, step_key =
"rosetta-${Network.lowerName
n}-${DebianVersions.lowerName
spec.debVersion}${Profiles.toLabelSegment
spec.profile}-docker-image"
}
)
spec.networks
, ZkappTestTransaction =
[ DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-zkapp-test-transaction"
, service =
Artifacts.dockerName Artifacts.Type.ZkappTestTransaction
, build_flags = spec.buildFlags
, deb_repo = DebianRepo.Type.Local
, deb_profile = spec.profile
Expand All @@ -236,13 +214,15 @@ let docker_step
"zkapp-test-transaction-${DebianVersions.lowerName
spec.debVersion}${Profiles.toLabelSegment
spec.profile}${BuildFlags.toLabelSegment
spec.buildFlags}--docker-image"
spec.buildFlags}-docker-image"
}
]
, FunctionalTestSuite =
[ DockerImage.ReleaseSpec::{
, deps = deps
, service = "mina-test-suite"
, service =
Artifacts.dockerName Artifacts.Type.FunctionalTestSuite
, network = Network.lowerName Network.Type.Devnet
, deb_codename =
"${DebianVersions.lowerName spec.debVersion}"
, build_flags = spec.buildFlags
Expand All @@ -252,8 +232,7 @@ let docker_step
"test-suite-${DebianVersions.lowerName
spec.debVersion}${Profiles.toLabelSegment
spec.profile}${BuildFlags.toLabelSegment
spec.buildFlags}--docker-image"
, network = "${Network.lowerName Network.Type.Devnet}"
spec.buildFlags}-docker-image"
}
]
}
Expand Down Expand Up @@ -288,6 +267,36 @@ let docker_commands
)
flattened_docker_steps

let publish_to_debian_repo =
\(spec : MinaBuildSpec.Type)
-> Command.build
Command.Config::{
, commands =
Toolchain.select
spec.toolchainSelectMode
spec.debVersion
[ "AWS_ACCESS_KEY_ID"
, "AWS_SECRET_ACCESS_KEY"
, "MINA_DEB_CODENAME=${DebianVersions.lowerName
spec.debVersion}"
, "MINA_DEB_RELEASE=${DebianChannel.lowerName spec.channel}"
]
"./buildkite/scripts/debian/publish.sh"
, label =
"Publish Mina for ${DebianVersions.capitalName
spec.debVersion} ${Profiles.toSuffixUppercase
spec.profile}"
, key = "publish-deb-pkg"
, depends_on =
DebianVersions.dependsOnStep
(Some spec.prefix)
spec.debVersion
spec.profile
spec.buildFlags
"build"
, target = Size.Small
}

let pipelineBuilder
: MinaBuildSpec.Type -> List Command.Type -> Pipeline.Config.Type
= \(spec : MinaBuildSpec.Type)
Expand Down
3 changes: 3 additions & 0 deletions buildkite/src/Command/ReplayerTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ let Size = ./Size.dhall

let RunWithPostgres = ./RunWithPostgres.dhall

let Network = ../Constants/Network.dhall

in { step =
\(dependsOn : List Command.TaggedKey.Type)
-> Command.build
Expand All @@ -15,6 +17,7 @@ in { step =
([] : List Text)
"./src/test/archive/sample_db/archive_db.sql"
Artifacts.Type.Archive
(None Network.Type)
"./buildkite/scripts/replayer-test.sh"
]
, label = "Archive: Replayer test"
Expand Down
25 changes: 23 additions & 2 deletions buildkite/src/Command/RunWithPostgres.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ let Prelude = ../External/Prelude.dhall

let P = Prelude

let Optional/map = Prelude.Optional.map

let Optional/default = Prelude.Optional.default

let Text/concatMap = P.Text.concatMap

let Cmd = ../Lib/Cmds.dhall
Expand All @@ -10,11 +14,19 @@ let ContainerImages = ../Constants/ContainerImages.dhall

let Artifacts = ../Constants/Artifacts.dhall

let Network = ../Constants/Network.dhall

let runInDockerWithPostgresConn
: List Text -> Text -> Artifacts.Type -> Text -> Cmd.Type
: List Text
-> Text
-> Artifacts.Type
-> Optional Network.Type
-> Text
-> Cmd.Type
= \(environment : List Text)
-> \(initScript : Text)
-> \(docker : Artifacts.Type)
-> \(network : Optional Network.Type)
-> \(innerScript : Text)
-> let port = "5432"

Expand All @@ -28,6 +40,15 @@ let runInDockerWithPostgresConn

let dbName = "archive"

let maybeNetwork =
Optional/map
Network.Type
Text
(\(network : Network.Type) -> "-${Network.lowerName network}")
network

let networkOrDefault = Optional/default Text "" maybeNetwork

let pg_conn =
"postgres://${user}:${password}@localhost:${port}/${dbName}"

Expand All @@ -46,7 +67,7 @@ let runInDockerWithPostgresConn

let outerDir
: Text
= "\\\$BUILDKITE_BUILD_CHECKOUT_PATH"
= "\\\$BUILDKITE_BUILD_CHECKOUT_PATH${networkOrDefault}"

let minaDockerTag
: Text
Expand Down
3 changes: 2 additions & 1 deletion buildkite/src/Constants/Artifacts.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ let dockerTag =
, LogProc = "${version_and_codename}"
, TestExecutive = "${version_and_codename}"
, BatchTxn = "${version_and_codename}"
, Rosetta = "${version_and_codename}"
, Rosetta =
"${version_and_codename}-${Network.lowerName network}"
, ZkappTestTransaction = "${version_and_codename}"
, FunctionalTestSuite = "${version_and_codename}"
}
Expand Down
Loading

0 comments on commit 79f6a40

Please sign in to comment.