From 8c0091fed1c981af048738f6ed536f88d25869db Mon Sep 17 00:00:00 2001 From: Henry Wong <132334382+henrywong-crypto@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:25:01 +0800 Subject: [PATCH] Update (#72) --- .github/workflows/ci.yml | 16 +++++++++++++++ flake.lock | 12 +++++------ flake.nix | 44 ++++++++++++++++++++++++++++++---------- 3 files changed, 55 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce1b418cf..032b70cec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ concurrency: env: MAINNET_VERSION: v24.9.0 + TESTNET_VERSION: v24.9.0 jobs: nix-build-aarch64: @@ -53,6 +54,14 @@ jobs: docker manifest create --amend ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION-amd64 docker manifest push ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION + nix build .#packages.aarch64-linux.testnet + docker load < result + docker tag testnet:nix ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-aarch64 + docker push ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-aarch64 + docker manifest create --amend ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-aarch64 + docker manifest create --amend ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-amd64 + docker manifest push ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION + nix-build-amd64: runs-on: ubuntu-latest @@ -89,3 +98,10 @@ jobs: docker push ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION-amd64 docker manifest create --amend ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION-amd64 docker manifest push ghcr.io/cronos-labs/external-node:mainnet-$MAINNET_VERSION + + nix build .#packages.x86_64-linux.testnet + docker load < result + docker tag testnet:nix ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-amd64 + docker push ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-amd64 + docker manifest create --amend ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION-amd64 + docker manifest push ghcr.io/cronos-labs/external-node:testnet-$TESTNET_VERSION diff --git a/flake.lock b/flake.lock index 6a1b4177c..7e3ab5d62 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723985069, - "narHash": "sha256-MGtXhZHLZGKhtZT/MYXBJEuMkZB5DLYjY679EYNL7Es=", + "lastModified": 1724300212, + "narHash": "sha256-x3jl6OWTs+L9C7EtscuWZmGZWI0iSBDafvg3X7JMa1A=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ff1c2669bbb4d0dd9e62cc94f0968cfa652ceec1", + "rev": "4de4818c1ffa76d57787af936e8a23648bda6be4", "type": "github" }, "original": { @@ -63,11 +63,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1724034091, - "narHash": "sha256-b1g7w0sw+MDAhUAeCoX1vlTghsqcDZkxr+k9OZmxPa8=", + "lastModified": 1724293269, + "narHash": "sha256-x/XhOAszT/ejditCHUtGOjQcVg2AQhrC/QVew3i7kTI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c7d36e0947826e0751a5214ffe82533fbc909bc0", + "rev": "6dc6d34a3a217457d7044dcce32b6d537480a6a1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index cd07e2016..5f8e10907 100644 --- a/flake.nix +++ b/flake.nix @@ -25,17 +25,21 @@ cargo = rust-bin.fromRustupToolchainFile (inputs.zksync-era + /rust-toolchain); rustc = rust-bin.fromRustupToolchainFile (inputs.zksync-era + /rust-toolchain); }; - base-image-mainnet = - (dockerTools.override - { - skopeo = pkgs.writeScriptBin "skopeo" ''exec ${skopeo}/bin/skopeo "$@" --authfile=/etc/docker/config.json''; - }) - .pullImage { - finalImageTag = "mainnet-v24.9.0"; - imageDigest = "sha256:aeaa2825da75b00fbd63e5f7f9dbd825098b1b068ed7397a479e9860b077af42"; - imageName = "ghcr.io/cronos-labs/zkevm-base-image"; - sha256 = "sha256-GQGaojsWBf0QNRSAj6vQAS+KElIXIRIBQxaxLEszpEs="; - }; + dockerTools' = dockerTools.override { + skopeo = pkgs.writeScriptBin "skopeo" ''exec ${skopeo}/bin/skopeo "$@" --authfile=/etc/docker/config.json''; + }; + base-image-mainnet = dockerTools'.pullImage { + finalImageTag = "mainnet-v24.9.0"; + imageDigest = "sha256:aeaa2825da75b00fbd63e5f7f9dbd825098b1b068ed7397a479e9860b077af42"; + imageName = "ghcr.io/cronos-labs/zkevm-base-image"; + sha256 = "sha256-GQGaojsWBf0QNRSAj6vQAS+KElIXIRIBQxaxLEszpEs="; + }; + base-image-testnet = dockerTools'.pullImage { + finalImageTag = "testnet-v24.9.0"; + imageDigest = "sha256:28a7022cda8e5aa6abffd296213b9d01261846a9557d66f86dcdf6720600dbec"; + imageName = "ghcr.io/cronos-labs/zkevm-base-image"; + sha256 = ""; + }; external-node = rustPlatform'.buildRustPackage.override {stdenv = clangStdenv;} { buildInputs = [openssl]; cargoBuildFlags = "--bin zksync_external_node"; @@ -65,5 +69,23 @@ exec ${external-node}/bin/zksync_external_node "$@" ''; }; + packages.testnet = dockerTools.buildImage { + name = "testnet"; + tag = "nix"; + fromImage = base-image-testnet; + copyToRoot = buildEnv { + name = "image-root"; + paths = [ + bashInteractive + coreutils + dockerTools.caCertificates + ]; + }; + config.Cmd = pkgs.writeScript "cmd" '' + #!${bash}/bin/bash + ${sqlx-cli}/bin/sqlx database setup + exec ${external-node}/bin/zksync_external_node "$@" + ''; + }; }); }