diff --git a/buildkite/src/Command/DockerImage.dhall b/buildkite/src/Command/DockerImage.dhall index 23b5d6b6b5f..5b9b7db9997 100644 --- a/buildkite/src/Command/DockerImage.dhall +++ b/buildkite/src/Command/DockerImage.dhall @@ -20,6 +20,7 @@ let ReleaseSpec = { deb_codename: Text, deb_release: Text, deb_version: Text, + deb_profile: Text, extra_args: Text, step_key: Text }, @@ -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" } } @@ -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}\\\"" ) ] diff --git a/buildkite/src/Command/MinaArtifact.dhall b/buildkite/src/Command/MinaArtifact.dhall index fa396fd7997..d9b07d40de0 100644 --- a/buildkite/src/Command/MinaArtifact.dhall +++ b/buildkite/src/Command/MinaArtifact.dhall @@ -16,17 +16,20 @@ 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 -> PipelineMode.Type -> Pipeline.Config.Type = \(debVersion : DebianVersions.DebVersion) -> -\(mode: PipelineMode.Type) -> +let pipeline : DebianVersions.DebVersion -> Profiles.Type -> PipelineMode.Type -> Pipeline.Config.Type = + \(debVersion : DebianVersions.DebVersion) -> + \(profile: Profiles.Type) -> + \(mode: PipelineMode.Type) -> Pipeline.Config::{ spec = JobSpec::{ dirtyWhen = DebianVersions.dirtyWhen debVersion, path = "Release", - name = "MinaArtifact${DebianVersions.capitalName debVersion}", + name = "MinaArtifact${DebianVersions.capitalName debVersion}${Profiles.toSuffixUppercase profile}", tags = [ PipelineTag.Type.Long, PipelineTag.Type.Release ], mode = mode }, @@ -34,16 +37,15 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config 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.duneProfile 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 = [ @@ -55,10 +57,11 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config -- 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" } @@ -68,7 +71,7 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config -- 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" @@ -78,7 +81,7 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config -- 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}", @@ -89,9 +92,10 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config -- 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 @@ -99,19 +103,18 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config -- rosetta image let rosettaSpec = DockerImage.ReleaseSpec::{ - deps=DebianVersions.dependsOn debVersion, + deps=DebianVersions.dependsOn debVersion profile, service="mina-rosetta", network="berkeley", deb_codename="${DebianVersions.lowerName debVersion}", step_key="rosetta-${DebianVersions.lowerName debVersion}-docker-image" } in - DockerImage.generateStep rosettaSpec, -- 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" @@ -126,7 +129,8 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config in { - bullseye = pipeline DebianVersions.DebVersion.Bullseye PipelineMode.Type.PullRequest - , buster = pipeline DebianVersions.DebVersion.Buster PipelineMode.Type.PullRequest - , focal = pipeline DebianVersions.DebVersion.Focal PipelineMode.Type.PullRequest -} + bullseye = pipeline DebianVersions.DebVersion.Bullseye Profiles.Type.Standard PipelineMode.Type.PullRequest + , bullseye-lightnet = pipeline DebianVersions.DebVersion.Bullseye Profiles.Type.Lightnet PipelineMode.Type.PullRequest + , buster = pipeline DebianVersions.DebVersion.Buster Profiles.Type.Standard PipelineMode.Type.PullRequest + , focal = pipeline DebianVersions.DebVersion.Focal Profiles.Type.Standard PipelineMode.Type.PullRequest + } diff --git a/buildkite/src/Constants/DebianVersions.dhall b/buildkite/src/Constants/DebianVersions.dhall index e7861667cf1..8c6b517f137 100644 --- a/buildkite/src/Constants/DebianVersions.dhall +++ b/buildkite/src/Constants/DebianVersions.dhall @@ -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 @@ -46,13 +47,15 @@ let toolchainImage = \(debVersion : DebVersion) -> , Focal = ContainerImages.minaToolchainBullseye } debVersion -let dependsOn = \(debVersion : DebVersion) -> +let dependsOn = \(debVersion : DebVersion) -> \(profile : Profiles.Type) -> + let profileSuffix = Profiles.toSuffixUppercase 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}${profileSuffix}", key = "build-deb-pkg" }] + , Bullseye = [{ name = "${prefix}${capitalName debVersion}${profileSuffix}", key = "build-deb-pkg" }] + , Buster = [{ name = "${prefix}${capitalName debVersion}${profileSuffix}", key = "build-deb-pkg" }] + , Jammy = [{ name = "${prefix}${capitalName debVersion}${profileSuffix}", key = "build-deb-pkg" }] + , Focal = [{ name = "${prefix}${capitalName debVersion}${profileSuffix}", key = "build-deb-pkg" }] } debVersion -- Most debian builds are only used for public releases @@ -105,4 +108,4 @@ in , toolchainImage = toolchainImage , dependsOn = dependsOn , dirtyWhen = dirtyWhen -} +} \ No newline at end of file diff --git a/buildkite/src/Constants/DockerVersions.dhall b/buildkite/src/Constants/DockerVersions.dhall new file mode 100644 index 00000000000..8febc3ae337 --- /dev/null +++ b/buildkite/src/Constants/DockerVersions.dhall @@ -0,0 +1,43 @@ +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 profileSuffix = Profiles.toSuffixUppercase profile in + let prefix = "MinaArtifact" in + let suffix = "docker-image" in + merge { + Bookworm = [{ name = "${prefix}${profileSuffix}", key = "${binary}-${lowerName docker}-${suffix}" }] + , Bullseye = [{ name = "${prefix}${capitalName docker}${profileSuffix}", key = "${binary}-${lowerName docker}-${suffix}" }] + , Buster = [{ name = "${prefix}${capitalName docker}${profileSuffix}", key = "${binary}-${lowerName docker}-${suffix}" }] + , Jammy = [{ name = "${prefix}${capitalName docker}${profileSuffix}", key = "${binary}-${lowerName docker}-${suffix}" }] + , Focal = [{ name = "${prefix}${capitalName docker}${profileSuffix}", key = "${binary}-${lowerName docker}-${suffix}" }] + } docker + +in + +{ + Type = Docker + , capitalName = capitalName + , lowerName = lowerName + , dependsOn = dependsOn +} \ No newline at end of file diff --git a/buildkite/src/Constants/Profiles.dhall b/buildkite/src/Constants/Profiles.dhall new file mode 100644 index 00000000000..ebaeedbec24 --- /dev/null +++ b/buildkite/src/Constants/Profiles.dhall @@ -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 +} diff --git a/buildkite/src/Jobs/Release/ItnOrchestratorArtifact.dhall b/buildkite/src/Jobs/Release/ItnOrchestratorArtifact.dhall index 99e193cf299..273dc322b8d 100644 --- a/buildkite/src/Jobs/Release/ItnOrchestratorArtifact.dhall +++ b/buildkite/src/Jobs/Release/ItnOrchestratorArtifact.dhall @@ -12,12 +12,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 diff --git a/buildkite/src/Jobs/Release/MinaArtifactBullseyeLightnet.dhall b/buildkite/src/Jobs/Release/MinaArtifactBullseyeLightnet.dhall new file mode 100644 index 00000000000..aa5d0b1e9e3 --- /dev/null +++ b/buildkite/src/Jobs/Release/MinaArtifactBullseyeLightnet.dhall @@ -0,0 +1,6 @@ +let ArtifactPipelines = ../../Command/MinaArtifact.dhall +let Pipeline = ../../Pipeline/Dsl.dhall + +in + +Pipeline.build ArtifactPipelines.bullseye-lightnet diff --git a/buildkite/src/Jobs/Test/CheckGraphQLSchema.dhall b/buildkite/src/Jobs/Test/CheckGraphQLSchema.dhall index 4583a5b38bc..ffc20a23110 100644 --- a/buildkite/src/Jobs/Test/CheckGraphQLSchema.dhall +++ b/buildkite/src/Jobs/Test/CheckGraphQLSchema.dhall @@ -5,10 +5,11 @@ let Pipeline = ../../Pipeline/Dsl.dhall let PipelineTag = ../../Pipeline/Tag.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 = diff --git a/buildkite/src/Jobs/Test/ConnectToBerkeley.dhall b/buildkite/src/Jobs/Test/ConnectToBerkeley.dhall index 4537de014e9..1da7e7ab693 100644 --- a/buildkite/src/Jobs/Test/ConnectToBerkeley.dhall +++ b/buildkite/src/Jobs/Test/ConnectToBerkeley.dhall @@ -5,10 +5,10 @@ let Pipeline = ../../Pipeline/Dsl.dhall let PipelineTag = ../../Pipeline/Tag.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 = diff --git a/buildkite/src/Jobs/Test/ReplayerTest.dhall.SUSPENDED b/buildkite/src/Jobs/Test/ReplayerTest.dhall.SUSPENDED index 25c3f4bf07f..e7ce7d92205 100644 --- a/buildkite/src/Jobs/Test/ReplayerTest.dhall.SUSPENDED +++ b/buildkite/src/Jobs/Test/ReplayerTest.dhall.SUSPENDED @@ -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::{ diff --git a/buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall b/buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall index 3cdce9b6276..55ae4668a60 100644 --- a/buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall +++ b/buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall @@ -13,7 +13,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"), @@ -47,7 +48,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" } ] } \ No newline at end of file diff --git a/buildkite/src/Jobs/Test/RunSnarkProfiler.dhall b/buildkite/src/Jobs/Test/RunSnarkProfiler.dhall index 7a8b0251f5a..016d0ff90c4 100644 --- a/buildkite/src/Jobs/Test/RunSnarkProfiler.dhall +++ b/buildkite/src/Jobs/Test/RunSnarkProfiler.dhall @@ -8,15 +8,16 @@ let Pipeline = ../../Pipeline/Dsl.dhall let PipelineTag = ../../Pipeline/Tag.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 diff --git a/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall b/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall index 2e918ff3432..24fa13be5f7 100644 --- a/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall +++ b/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall @@ -6,16 +6,17 @@ let PipelineMode = ../../Pipeline/Mode.dhall let PipelineTag = ../../Pipeline/Tag.dhall let TestExecutive = ../../Command/TestExecutive.dhall +let Profiles = ../../Constants/Profiles.dhall +let Dockers = ../../Constants/DockerVersions.dhall -let dependsOn = [ - { name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" }, - { name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" } -] -let dependsOnJs = [ - { name = "TestnetIntegrationTests", key = "build-js-tests" }, - { name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" }, - { name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" } -] +let dependsOn = + 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-js-tests" }] + # Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley" + # Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive" in Pipeline.build Pipeline.Config::{ spec = diff --git a/buildkite/src/Jobs/Test/TestnetIntegrationTestsLong.dhall b/buildkite/src/Jobs/Test/TestnetIntegrationTestsLong.dhall index 271a99d08e9..88f0696b036 100644 --- a/buildkite/src/Jobs/Test/TestnetIntegrationTestsLong.dhall +++ b/buildkite/src/Jobs/Test/TestnetIntegrationTestsLong.dhall @@ -5,11 +5,11 @@ let Pipeline = ../../Pipeline/Dsl.dhall let PipelineMode = ../../Pipeline/Mode.dhall let PipelineTag = ../../Pipeline/Tag.dhall let TestExecutive = ../../Command/TestExecutive.dhall +let Profiles = ../../Constants/Profiles.dhall +let Dockers = ../../Constants/DockerVersions.dhall -let dependsOn = [ - { name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" }, - { name = "MinaArtifactBullseye", key = "archive-bullseye-docker-image" } -] +let dependsOn = Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley" + # Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive" in Pipeline.build Pipeline.Config::{ spec = diff --git a/dockerfiles/Dockerfile-mina-archive b/dockerfiles/Dockerfile-mina-archive index ff55ea62aec..216fa57ee04 100644 --- a/dockerfiles/Dockerfile-mina-archive +++ b/dockerfiles/Dockerfile-mina-archive @@ -5,7 +5,17 @@ FROM ${image} ARG deb_version ARG deb_codename=bullseye ARG deb_release=unstable +ARG deb_profile +# if --build-arg deb_profile is defined, add hypen at beginning. +ENV SUFFIX=${deb_profile:+-${deb_profile}} +# construct mina debian package name based on network and suffix. +# possible values: +# - mina-archive +# - mina-archive-lightnet etc. +ENV MINA_DEB=mina-archive${SUFFIX} + +ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive RUN echo "Building image with version $deb_codename $deb_release $deb_version" @@ -38,7 +48,7 @@ RUN mkdir /healthcheck && curl https://raw.githubusercontent.com/MinaProtocol/mi # archive-node package RUN echo "deb [trusted=yes] http://packages.o1test.net $deb_codename $deb_release" > /etc/apt/sources.list.d/o1.list \ && apt-get update --quiet --yes \ - && apt-get install --quiet --yes "mina-archive=$deb_version" \ + && apt-get install --quiet --yes "${MINA_DEB}=$deb_version" \ && rm -rf /var/lib/apt/lists/* ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"] diff --git a/dockerfiles/Dockerfile-mina-daemon b/dockerfiles/Dockerfile-mina-daemon index 9bcfe814c54..954a9423428 100644 --- a/dockerfiles/Dockerfile-mina-daemon +++ b/dockerfiles/Dockerfile-mina-daemon @@ -5,6 +5,15 @@ ARG deb_version ARG deb_release=unstable ARG deb_codename=bullseye ARG network=mainnet +ARG deb_profile + +# if --build-arg deb_profile is defined, add hypen at beginning. +ENV SUFFIX=${deb_profile:+-${deb_profile}} +# construct mina debian package name based on network and suffix. +# possible values: +# - mina-berkeley +# - mina-berkeley-lightnet etc. +ENV MINA_DEB=mina-${network}${SUFFIX} ENV DEBIAN_FRONTEND noninteractive @@ -59,7 +68,7 @@ ENV USE_GKE_GCLOUD_AUTH_PLUGIN=True RUN echo "Building image with version $deb_version from repo $deb_release $deb_codename for network $network" \ && echo "deb [trusted=yes] http://packages.o1test.net $deb_codename $deb_release" > /etc/apt/sources.list.d/o1.list \ && apt-get update --quiet --yes \ - && apt-get install --quiet --yes --allow-downgrades "mina-$network=$deb_version" \ + && apt-get install --quiet --yes --allow-downgrades "${MINA_DEB}=$deb_version" \ && rm -rf /var/lib/apt/lists/* diff --git a/scripts/archive/build-release-archives.sh b/scripts/archive/build-release-archives.sh index ec673cd5faf..d0541b3aecc 100755 --- a/scripts/archive/build-release-archives.sh +++ b/scripts/archive/build-release-archives.sh @@ -29,7 +29,21 @@ esac echo "--- Building Mina archive package" -PROJECT="mina-archive" + +# Determina suffix for mina name. To preserve backward compatibility devnet profile won't have any suffix. +# For others profiles we are adding suffix. For example '-lightnet' +case "${DUNE_PROFILE}" in + devnet) + PROJECT_SUFFIX="" + ;; + *) + PROJECT_SUFFIX="-${DUNE_PROFILE}" + ;; +esac + + + +PROJECT="mina-archive${PROJECT_SUFFIX}" BUILD_DIR="deb_build" ###### archiver deb diff --git a/scripts/rebuild-deb.sh b/scripts/rebuild-deb.sh index 8a5a9015cab..043d01a1d75 100755 --- a/scripts/rebuild-deb.sh +++ b/scripts/rebuild-deb.sh @@ -45,10 +45,17 @@ case "${MINA_DEB_CODENAME}" in ;; esac +case "${DUNE_PROFILE}" in + devnet) + MINA_DEB_NAME="mina-berkeley" + ;; + *) + MINA_DEB_NAME="mina-berkeley-${DUNE_PROFILE}" + ;; +esac BUILDDIR="deb_build" - # Function to ease creation of Debian package control files create_control_file() { @@ -283,11 +290,11 @@ echo "------------------------------------------------------------" echo "--- Building Mina Berkeley testnet signatures deb without keys:" mkdir -p "${BUILDDIR}/DEBIAN" -create_control_file mina-berkeley "${SHARED_DEPS}${DAEMON_DEPS}" 'Mina Protocol Client and Daemon' +create_control_file "${MINA_DEB_NAME}" "${SHARED_DEPS}${DAEMON_DEPS}" 'Mina Protocol Client and Daemon' copy_common_daemon_configs berkeley testnet 'seed-lists/berkeley_seeds.txt' -build_deb mina-berkeley +build_deb "${MINA_DEB_NAME}" ##################################### END BERKELEY PACKAGE ####################################### diff --git a/scripts/release-docker.sh b/scripts/release-docker.sh index cbf5b26289c..ffe2b2c0e52 100755 --- a/scripts/release-docker.sh +++ b/scripts/release-docker.sh @@ -24,6 +24,7 @@ function usage() { echo " --deb-codename The debian codename (stretch or buster) to build the docker image from. Default=stretch" echo " --deb-release The debian package release channel to pull from (unstable,alpha,beta,stable). Default=unstable" echo " --deb-version The version string for the debian package to install" + echo " --deb-profile The profile string for the debian package to install" echo "" echo "Example: $0 --service faucet --version v0.1.0" echo "Valid Services: ${VALID_SERVICES[*]}" @@ -40,6 +41,7 @@ while [[ "$#" -gt 0 ]]; do case $1 in --deb-codename) DEB_CODENAME="--build-arg deb_codename=$2"; shift;; --deb-release) DEB_RELEASE="--build-arg deb_release=$2"; shift;; --deb-version) DEB_VERSION="--build-arg deb_version=$2"; shift;; + --deb-profile) DEB_PROFILE="$2"; shift;; --extra-args) EXTRA=${@:2}; shift $((${#}-1));; *) echo "Unknown parameter passed: $1"; exit 1;; esac; shift; done @@ -55,9 +57,20 @@ case "${DEB_CODENAME##*=}" in esac IMAGE="--build-arg image=${IMAGE}" +# Determina profile for mina name. To preserve backward compatibility standard profile is default. +case "${DEB_PROFILE}" in + standard) + DEB_PROFILE="" + ;; + *) + DEB_PROFILE="--build-arg deb_profile=${DEB_PROFILE}" + ;; +esac + + # Debug prints for visability # Substring removal to cut the --build-arg arguments on the = so that the output is exactly the input flags https://wiki.bash-hackers.org/syntax/pe#substring_removal -echo "--service ${SERVICE} --version ${VERSION} --branch ${BRANCH##*=} --deb-version ${DEB_VERSION##*=} --deb-release ${DEB_RELEASE##*=} --deb-codename ${DEB_CODENAME##*=}" +echo "--service ${SERVICE} --version ${VERSION} --branch ${BRANCH##*=} --deb-version ${DEB_VERSION##*=} --deb-profile ${DEB_PROFILE##*=} --deb-release ${DEB_RELEASE##*=} --deb-codename ${DEB_CODENAME##*=}" echo ${EXTRA} echo "docker image: ${IMAGE}" @@ -80,6 +93,7 @@ mina-daemon) DOCKERFILE_PATH="dockerfiles/Dockerfile-mina-daemon" DOCKER_CONTEXT="dockerfiles/" VERSION="${VERSION}-${NETWORK##*=}" + SERVICE=${SERVICE}${SERVICE_SUFFIX} ;; mina-toolchain) DOCKERFILE_PATH="dockerfiles/stages/1-build-deps dockerfiles/stages/2-opam-deps dockerfiles/stages/3-toolchain" @@ -134,9 +148,9 @@ HASHTAG="${DOCKER_REGISTRY}/${SERVICE}:${GITHASH}-${DEB_CODENAME##*=}-${NETWORK# # If DOCKER_CONTEXT is not specified, assume none and just pipe the dockerfile into docker build extra_build_args=$(echo ${EXTRA} | tr -d '"') if [[ -z "${DOCKER_CONTEXT}" ]]; then - cat $DOCKERFILE_PATH | docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args -t "$TAG" - + cat $DOCKERFILE_PATH | docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DEB_PROFILE $BRANCH $REPO $extra_build_args -t "$TAG" - else - docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args $DOCKER_CONTEXT -t "$TAG" -f $DOCKERFILE_PATH + docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DEB_PROFILE $BRANCH $REPO $extra_build_args $DOCKER_CONTEXT -t "$TAG" -f $DOCKERFILE_PATH fi if [[ -z "$NOUPLOAD" ]] || [[ "$NOUPLOAD" -eq 0 ]]; then