From f6acf4bc37ccb15039d9b027f6258641802a8c13 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 18 Jun 2018 13:45:53 -0700 Subject: [PATCH] Package solana as a snap --- ci/.gitignore | 1 + ci/buildkite.yml | 7 ++++-- ci/docker-run.sh | 8 ++++++- ci/{publish.sh => publish-crate.sh} | 0 ci/publish-snap.sh | 32 +++++++++++++++++++++++++++ snap/snapcraft.yaml | 34 +++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 3 deletions(-) rename ci/{publish.sh => publish-crate.sh} (100%) create mode 100755 ci/publish-snap.sh create mode 100644 snap/snapcraft.yaml diff --git a/ci/.gitignore b/ci/.gitignore index 936e5c57af9478..293cbe23dbdd60 100644 --- a/ci/.gitignore +++ b/ci/.gitignore @@ -1,2 +1,3 @@ /node_modules/ /package-lock.json +/snapcraft.credentials diff --git a/ci/buildkite.yml b/ci/buildkite.yml index fbf4225d1828e3..bc61f49ad98c02 100644 --- a/ci/buildkite.yml +++ b/ci/buildkite.yml @@ -26,6 +26,9 @@ steps: agents: - "queue=cuda" - wait - - command: "ci/publish.sh" + - command: "ci/docker-run.sh snapcraft/xenial-amd64 ci/publish-snap.sh" timeout_in_minutes: 20 - name: "publish release artifacts" + name: "publish snap" + - command: "ci/publish-crate.sh" + timeout_in_minutes: 20 + name: "publish crate" diff --git a/ci/docker-run.sh b/ci/docker-run.sh index 889d568b760df3..a10bde9d41b509 100755 --- a/ci/docker-run.sh +++ b/ci/docker-run.sh @@ -19,7 +19,12 @@ fi docker pull "$IMAGE" shift -ARGS=(--workdir /solana --volume "$PWD:/solana" --rm) +ARGS=( + --workdir /solana + --volume "$PWD:/solana" + --env "HOME=/solana" + --rm +) ARGS+=(--env "CARGO_HOME=/solana/.cargo") @@ -35,6 +40,7 @@ ARGS+=( --env BUILDKITE_TAG --env CODECOV_TOKEN --env CRATES_IO_TOKEN + --env SNAPCRAFT_CREDENTIALS_KEY ) set -x diff --git a/ci/publish.sh b/ci/publish-crate.sh similarity index 100% rename from ci/publish.sh rename to ci/publish-crate.sh diff --git a/ci/publish-snap.sh b/ci/publish-snap.sh new file mode 100755 index 00000000000000..ad9232a7b8cfef --- /dev/null +++ b/ci/publish-snap.sh @@ -0,0 +1,32 @@ +#!/bin/bash -e + +cd "$(dirname "$0")/.." + +DRYRUN= +if [[ -z $BUILDKITE_BRANCH || $BUILDKITE_BRANCH =~ pull/* ]]; then + DRYRUN="echo" +fi + +if [[ -z "$BUILDKITE_TAG" ]]; then + SNAP_CHANNEL=edge +else + SNAP_CHANNEL=beta +fi + +if [[ -n $SNAPCRAFT_CREDENTIALS_KEY ]]; then + ( + openssl aes-256-cbc -d \ + -in ci/snapcraft.credentials.enc \ + -out ci/snapcraft.credentials \ + -k "$SNAPCRAFT_CREDENTIALS_KEY" + + snapcraft login --with ci/snapcraft.credentials + ) || { + rm -f ci/snapcraft.credentials; + exit 1 + } +fi + +set -x +snapcraft +$DRYRUN snapcraft push solana_*.snap --release $SNAP_CHANNEL diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000000000..503994ec4c452f --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,34 @@ +name: solana +version: git +summary: Blockchain, Rebuilt for Scale +description: | + 710,000 tx/s with off-the-shelf hardware and no sharding. + Scales with Moore's Law. +grade: devel +confinement: strict + +apps: + fullnode: + command: solana-fullnode + plugs: + - network + - network-bind + - home + fullnode-config: + command: solana-fullnode-config + plugs: + - network + - network-bind + genesis: + command: solana-genesis + genesis-demo: + command: solana-genesis-demo + mint: + command: solana-mint + mint-demo: + command: solana-mint-demo + +parts: + solana: + plugin: rust + rust-channel: stable