Skip to content

Commit

Permalink
Add suffix to dockers and debian packages built with different profil…
Browse files Browse the repository at this point in the history
…e that devnet
  • Loading branch information
dkijania committed Oct 4, 2023
1 parent 87ba719 commit f9b5281
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 56 deletions.
6 changes: 4 additions & 2 deletions buildkite/src/Command/DockerImage.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let ReleaseSpec = {
deb_codename: Text,
deb_release: Text,
deb_version: Text,
deb_profile: Text,
extra_args: Text,
step_key: Text
},
Expand All @@ -30,10 +31,11 @@ let ReleaseSpec = {
service = "\\\${MINA_SERVICE}",
branch = "\\\${BUILDKITE_BRANCH}",
deb_codename = "bullseye",
deb_profile = "devnet",
deb_release = "\\\${MINA_DEB_RELEASE}",
deb_version = "\\\${MINA_DEB_VERSION}",
extra_args = "",
step_key = "daemon-devnet-docker-image"
step_key = "daemon-standard-docker-image"
}
}

Expand All @@ -43,7 +45,7 @@ let generateStep = \(spec : ReleaseSpec.Type) ->
[
Cmd.run (
"export MINA_DEB_CODENAME=${spec.deb_codename} && source ./buildkite/scripts/export-git-env-vars.sh && ./scripts/release-docker.sh " ++
"--service ${spec.service} --version ${spec.version} --network ${spec.network} --branch ${spec.branch} --deb-codename ${spec.deb_codename} --deb-release ${spec.deb_release} --deb-version ${spec.deb_version} --extra-args \\\"${spec.extra_args}\\\""
"--service ${spec.service} --version ${spec.version} --network ${spec.network} --branch ${spec.branch} --deb-codename ${spec.deb_codename} --deb-release ${spec.deb_release} --deb-version ${spec.deb_version} --deb-profile ${spec.deb_profile} --extra-args \\\"${spec.extra_args}\\\""
)
]

Expand Down
44 changes: 24 additions & 20 deletions buildkite/src/Command/MinaArtifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,32 @@ let Size = ./Size.dhall
let Libp2p = ./Libp2pHelperBuild.dhall
let DockerImage = ./DockerImage.dhall
let DebianVersions = ../Constants/DebianVersions.dhall
let Profiles = ../Constants/Profiles.dhall

in

let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion : DebianVersions.DebVersion) ->
let pipeline : DebianVersions.DebVersion -> Profiles.Type -> Pipeline.Config.Type = \(debVersion : DebianVersions.DebVersion) ->
\(profile: Profiles.Type) ->
Pipeline.Config::{
spec =
JobSpec::{
dirtyWhen = DebianVersions.dirtyWhen debVersion,
path = "Release",
name = "MinaArtifact${DebianVersions.capitalName debVersion}"
name = "MinaArtifact${DebianVersions.capitalName debVersion}${Profiles.toSuffixUppercase profile}"
},
steps = [
Libp2p.step debVersion,
Command.build
Command.Config::{
commands =
DebianVersions.toolchainRunner debVersion [
"DUNE_PROFILE=devnet",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"MINA_BRANCH=$BUILDKITE_BRANCH",
"MINA_COMMIT_SHA1=$BUILDKITE_COMMIT",
"MINA_DEB_CODENAME=${DebianVersions.lowerName debVersion}"
] "./buildkite/scripts/build-artifact.sh",
label = "Build Mina for ${DebianVersions.capitalName debVersion}",
commands = DebianVersions.toolchainRunner debVersion [
"DUNE_PROFILE=${Profiles.lowerName profile}",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"MINA_BRANCH=$BUILDKITE_BRANCH",
"MINA_COMMIT_SHA1=$BUILDKITE_COMMIT",
"MINA_DEB_CODENAME=${DebianVersions.lowerName debVersion}"
] "./buildkite/scripts/build-artifact.sh",
label = "Build Mina for ${DebianVersions.capitalName debVersion} ${Profiles.toSuffixUppercase profile}",
key = "build-deb-pkg",
target = Size.XLarge,
retries = [
Expand All @@ -49,10 +50,11 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

-- daemon berkeley image
let daemonBerkeleySpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
deps=DebianVersions.dependsOn debVersion profile,
service="mina-daemon",
network="berkeley",
deb_codename="${DebianVersions.lowerName debVersion}",
deb_profile="${Profiles.lowerName profile}",
step_key="daemon-berkeley-${DebianVersions.lowerName debVersion}-docker-image"
}

Expand All @@ -62,7 +64,7 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

-- test_executive image
let testExecutiveSpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
deps=DebianVersions.dependsOn debVersion profile,
service="mina-test-executive",
deb_codename="${DebianVersions.lowerName debVersion}",
step_key="test-executive-${DebianVersions.lowerName debVersion}-docker-image"
Expand All @@ -72,7 +74,7 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

-- batch_txn_tool image
let batchTxnSpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
deps=DebianVersions.dependsOn debVersion profile,
service="mina-batch-txn",
network="berkeley",
deb_codename="${DebianVersions.lowerName debVersion}",
Expand All @@ -83,9 +85,10 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

-- archive image
let archiveSpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
deps=DebianVersions.dependsOn debVersion profile,
service="mina-archive",
deb_codename="${DebianVersions.lowerName debVersion}",
deb_profile="${Profiles.lowerName profile}",
step_key="archive-${DebianVersions.lowerName debVersion}-docker-image"
}
in
Expand All @@ -104,7 +107,7 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

-- ZkApp test transaction image
let zkappTestTxnSpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
deps=DebianVersions.dependsOn debVersion profile,
service="mina-zkapp-test-transaction",
deb_codename="${DebianVersions.lowerName debVersion}",
step_key="zkapp-test-transaction-${DebianVersions.lowerName debVersion}-docker-image"
Expand All @@ -119,7 +122,8 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion

in
{
bullseye = pipeline DebianVersions.DebVersion.Bullseye
, buster = pipeline DebianVersions.DebVersion.Buster
, focal = pipeline DebianVersions.DebVersion.Focal
bullseye = pipeline DebianVersions.DebVersion.Bullseye Profiles.Type.Standard
, bullseye-lightnet = pipeline DebianVersions.DebVersion.Bullseye Profiles.Type.Lightnet
, buster = pipeline DebianVersions.DebVersion.Buster Profiles.Type.Standard
, focal = pipeline DebianVersions.DebVersion.Focal Profiles.Type.Standard
}
17 changes: 10 additions & 7 deletions buildkite/src/Constants/DebianVersions.dhall
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let Prelude = ../External/Prelude.dhall
let RunInToolchain = ../Command/RunInToolchain.dhall
let ContainerImages = ./ContainerImages.dhall
let Profiles = ./Profiles.dhall
let S = ../Lib/SelectFiles.dhall
let D = S.PathPattern

Expand Down Expand Up @@ -46,13 +47,15 @@ let toolchainImage = \(debVersion : DebVersion) ->
, Focal = ContainerImages.minaToolchainBullseye
} debVersion

let dependsOn = \(debVersion : DebVersion) ->
let dependsOn = \(debVersion : DebVersion) -> \(profile : Profiles.Type) ->
let profileName = Profiles.capitalName profile in
let prefix = "MinaArtifact" in
merge {
Bookworm = [{ name = "MinaArtifactBookworm", key = "build-deb-pkg" }]
, Bullseye = [{ name = "MinaArtifactBullseye", key = "build-deb-pkg" }]
, Buster = [{ name = "MinaArtifactBuster", key = "build-deb-pkg" }]
, Jammy = [{ name = "MinaArtifactJammy", key = "build-deb-pkg" }]
, Focal = [{ name = "MinaArtifactFocal", key = "build-deb-pkg" }]
Bookworm = [{ name = "${prefix}${profileName}", key = "build-deb-pkg" }]
, Bullseye = [{ name = "${prefix}${capitalName debVersion}${profileName}", key = "build-deb-pkg" }]
, Buster = [{ name = "${prefix}${capitalName debVersion}${profileName}", key = "build-deb-pkg" }]
, Jammy = [{ name = "${prefix}${capitalName debVersion}${profileName}", key = "build-deb-pkg" }]
, Focal = [{ name = "${prefix}${capitalName debVersion}${profileName}", key = "build-deb-pkg" }]
} debVersion

-- Most debian builds are only used for public releases
Expand Down Expand Up @@ -101,4 +104,4 @@ in
, toolchainImage = toolchainImage
, dependsOn = dependsOn
, dirtyWhen = dirtyWhen
}
}
42 changes: 42 additions & 0 deletions buildkite/src/Constants/DockerVersions.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
let Prelude = ../External/Prelude.dhall
let Profiles = ./Profiles.dhall

let Docker: Type = < Bookworm | Bullseye | Buster | Jammy | Focal >

let capitalName = \(docker : Docker) ->
merge {
Bookworm = "Bookworm"
, Bullseye = "Bullseye"
, Buster = "Buster"
, Jammy = "Jammy"
, Focal = "Focal"
} docker

let lowerName = \(docker : Docker) ->
merge {
Bookworm = "bookworm"
, Bullseye = "bullseye"
, Buster = "buster"
, Jammy = "jammy"
, Focal = "focal"
} docker

let dependsOn = \(docker : Docker) -> \(profile : Profiles.Type) -> \(binary: Text) ->
let profileName = Profiles.capitalName profile in
let prefix = "MinaArtifact" in
merge {
Bookworm = [{ name = "${prefix}${profileName}", key = "${binary}-${lowerName docker}-docker-image" }]
, Bullseye = [{ name = "${prefix}${capitalName docker}${profileName}", key = "${binary}-${lowerName docker}-docker-image" }]
, Buster = [{ name = "${prefix}${capitalName docker}${profileName}", key = "${binary}-${lowerName docker}-docker-image" }]
, Jammy = [{ name = "${prefix}${capitalName docker}${profileName}", key = "${binary}-${lowerName docker}-docker-image" }]
, Focal = [{ name = "${prefix}${capitalName docker}${profileName}", key = "${binary}-${lowerName docker}-docker-image" }]
} docker

in

{
Type = Docker
, capitalName = capitalName
, lowerName = lowerName
, dependsOn = dependsOn
}
46 changes: 46 additions & 0 deletions buildkite/src/Constants/Profiles.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
let Prelude = ../External/Prelude.dhall

let Profile : Type = < Standard | Lightnet >

let capitalName = \(profile : Profile) ->
merge {
Standard = "Standard"
, Lightnet = "Lightnet"
} profile

let lowerName = \(profile : Profile) ->
merge {
Standard = "standard"
, Lightnet = "lightnet"
} profile

let duneProfile = \(profile : Profile) ->
merge {
Standard = "devnet"
, Lightnet = "lightnet"
} profile

let toSuffixUppercase = \(profile : Profile) ->
merge {
Standard = ""
, Lightnet = "Lightnet"
} profile

let toSuffixLowercase = \(profile : Profile) ->
merge {
Standard = ""
, Lightnet = "lightnet"
} profile



in

{
Type = Profile
, capitalName = capitalName
, lowerName = lowerName
, duneProfile = duneProfile
, toSuffixUppercase = toSuffixUppercase
, toSuffixLowercase = toSuffixLowercase
}
4 changes: 3 additions & 1 deletion buildkite/src/Jobs/Release/ItnOrchestratorArtifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ let JobSpec = ../../Pipeline/JobSpec.dhall
let Command = ../../Command/Base.dhall
let Size = ../../Command/Size.dhall
let DockerImage = ../../Command/DockerImage.dhall
let Profiles = ../../Constants/Profiles.dhall
let DebianVersions = ../../Constants/DebianVersions.dhall

let spec = DockerImage.ReleaseSpec::{
service="itn-orchestrator",
step_key="itn-orchestrator-docker-image",
network="berkeley",
deps = [ { name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" } ]
deps = DebianVersions.dependsOn DebianVersions.DebVersion.Bullseye Profiles.Type.Standard
}

in
Expand Down
6 changes: 6 additions & 0 deletions buildkite/src/Jobs/Release/MinaArtifactBullseyeLightnet.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let ArtifactPipelines = ../../Command/MinaArtifact.dhall
let Pipeline = ../../Pipeline/Dsl.dhall

in

Pipeline.build ArtifactPipelines.bullseye-lightnet
7 changes: 4 additions & 3 deletions buildkite/src/Jobs/Test/CheckGraphQLSchema.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ let JobSpec = ../../Pipeline/JobSpec.dhall
let Pipeline = ../../Pipeline/Dsl.dhall

let CheckGraphQLSchema = ../../Command/CheckGraphQLSchema.dhall
let DebianVersions = ../../Constants/DebianVersions.dhall
let Profiles = ../../Constants/Profiles.dhall

let dependsOn = DebianVersions.dependsOn DebianVersions.DebVersion.Bullseye Profiles.Type.Standard

let dependsOn = [
{ name = "MinaArtifactBullseye", key = "build-deb-pkg" }
]

in Pipeline.build Pipeline.Config::{
spec =
Expand Down
6 changes: 3 additions & 3 deletions buildkite/src/Jobs/Test/ConnectToBerkeley.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ let JobSpec = ../../Pipeline/JobSpec.dhall
let Pipeline = ../../Pipeline/Dsl.dhall

let ConnectToTestnet = ../../Command/ConnectToTestnet.dhall
let Profiles = ../../Constants/Profiles.dhall
let Dockers = ../../Constants/DockerVersions.dhall

let dependsOn = [
{ name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" }
]
let dependsOn = Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley"

in Pipeline.build Pipeline.Config::{
spec =
Expand Down
5 changes: 3 additions & 2 deletions buildkite/src/Jobs/Test/ReplayerTest.dhall.SUSPENDED
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ let Pipeline = ../../Pipeline/Dsl.dhall
let JobSpec = ../../Pipeline/JobSpec.dhall

let ReplayerTest = ../../Command/ReplayerTest.dhall
let Profiles = ../../Constants/Profiles.dhall
let Dockers = ../../Constants/DockerVersions.dhall

let dependsOn =
[ { name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" } ]
let dependsOn = Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive"

in Pipeline.build
Pipeline.Config::{
Expand Down
5 changes: 3 additions & 2 deletions buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let RunInToolchain = ../../Command/RunInToolchain.dhall
let Size = ../../Command/Size.dhall
let Libp2p = ../../Command/Libp2pHelperBuild.dhall
let DockerImage = ../../Command/DockerImage.dhall
let DebianVersions = ../../Constants/DebianVersions.dhall
let Profiles = ../../Constants/Profiles.dhall
let Dockers = ../../Constants/DockerVersions.dhall

let dirtyWhen = [
S.strictlyStart (S.contains "src/app/rosetta"),
Expand Down Expand Up @@ -44,7 +45,7 @@ Pipeline.build
label = "Rosetta integration tests Bullseye"
, key = "rosetta-integration-tests-bullseye"
, target = Size.Small
, depends_on = [ { name = "MinaArtifactBullseye", key = "rosetta-bullseye-docker-image" } ]
, depends_on = Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "rosetta"
}
]
}
7 changes: 4 additions & 3 deletions buildkite/src/Jobs/Test/RunSnarkProfiler.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ let D = S.PathPattern
let Pipeline = ../../Pipeline/Dsl.dhall
let JobSpec = ../../Pipeline/JobSpec.dhall

let DebianVersions = ../../Constants/DebianVersions.dhall
let Profiles = ../../Constants/Profiles.dhall

let Command = ../../Command/Base.dhall
let RunInToolchain = ../../Command/RunInToolchain.dhall
let Docker = ../../Command/Docker/Type.dhall
let Size = ../../Command/Size.dhall


let dependsOn = [
{ name = "MinaArtifactBullseye", key = "build-deb-pkg" }
]
let dependsOn = DebianVersions.dependsOn DebianVersions.DebVersion.Bullseye Profiles.Type.Standard

in

Expand Down
14 changes: 9 additions & 5 deletions buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ let JobSpec = ../../Pipeline/JobSpec.dhall
let Pipeline = ../../Pipeline/Dsl.dhall
let PipelineMode = ../../Pipeline/Mode.dhall
let TestExecutive = ../../Command/TestExecutive.dhall
let Profiles = ../../Constants/Profiles.dhall
let Dockers = ../../Constants/DockerVersions.dhall

let dependsOn = [
{ name = "TestnetIntegrationTests", key = "build-test-executive" },
{ name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" },
{ name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" }
{ name = "TestnetIntegrationTests", key = "build-test-executive" },
Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley",
Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive"
]
in

let dependsOnJs = [
{ name = "TestnetIntegrationTests", key = "build-test-executive" },
{ name = "TestnetIntegrationTests", key = "build-js-tests" },
{ name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" },
{ name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" }
Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley",
Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive"
]

in Pipeline.build Pipeline.Config::{
Expand Down
Loading

0 comments on commit f9b5281

Please sign in to comment.