Skip to content

Commit

Permalink
ci: Add mater Docker build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan committed Nov 12, 2024
1 parent 11607f3 commit d71b7bf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ concurrency:
jobs:
build_and_release_mater_cli:
runs-on: self-hosted
permissions:
contents: read
packages: write

if: github.ref_type == 'tag' && startsWith(github.ref_name, 'mater-cli-v')

Expand All @@ -41,17 +44,29 @@ jobs:
exit 1;
fi
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release --locked --package mater-cli
# - name: Build in release mode
# run: RUSTFLAGS="-D warnings" cargo build --release --locked --package mater-cli

- name: Release binaries
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
# - name: Release binaries
# uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
# with:
# tag_name: ${{ github.ref_name }} # set the name of the release the tag
# files: |
# target/release/mater-cli

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
tag_name: ${{ github.ref_name }} # set the name of the release the tag
files: |
target/release/mater-cli
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and publish image
run: |
docker build --build-arg VCS_REF="$(git rev-parse HEAD)" --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" --tag ghcr.io/eigerco/mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" --file ./docker/dockerfiles/mater-cli.Dockerfile .
docker push ghcr.io/eigerco/mater-cli:"$(cargo metadata --no-deps --color never --format-version 1 --locked | jq -r '.packages[].version')"
build_and_release_storagext_cli:
runs-on: self-hosted
Expand Down
26 changes: 14 additions & 12 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ build-mater-cli:
# Build all the binaries
build-binaries-all: build-polka-storage-node build-polka-storage-provider-client build-polka-storage-provider-server build-storagext-cli build-mater-cli

# TODO: the docker builds point to the azure container registry — they shouldn't
# we should be using the GHCR this time

# NOTE: Docker builds have no ghcr prefix because these are built locally.
# The Docker images built in the CI will point to the ghcr.
# Done to differenciate between local images and pulled images.

# Build the mater CLI binary
build-mater-docker:
docker build \
--build-arg VCS_REF="$(git rev-parse HEAD)" \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t polkadotstorage.azurecr.io/mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
-t mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
--file ./docker/dockerfiles/mater-cli.Dockerfile \
.

Expand All @@ -82,7 +84,7 @@ build-polka-storage-node-docker:
docker build \
--build-arg VCS_REF="$(git rev-parse HEAD)" \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t polkadotstorage.azurecr.io/polka-storage-node:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
-t polka-storage-node:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
--file ./docker/dockerfiles/polka-storage-node.Dockerfile \
.

Expand All @@ -91,7 +93,7 @@ build-polka-storage-provider-client-docker:
docker build \
--build-arg VCS_REF="$(git rev-parse HEAD)" \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t polkadotstorage.azurecr.io/polka-storage-provider-client:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
-t polka-storage-provider-client:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
--file ./docker/dockerfiles/polka-storage-provider-client.Dockerfile \
.

Expand All @@ -100,7 +102,7 @@ build-polka-storage-provider-server-docker:
docker build \
--build-arg VCS_REF="$(git rev-parse HEAD)" \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t polkadotstorage.azurecr.io/polka-storage-provider-server:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
-t polka-storage-provider-server:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
--file ./docker/dockerfiles/polka-storage-provider-server.Dockerfile \
.

Expand All @@ -109,7 +111,7 @@ build-storagext-docker:
docker build \
--build-arg VCS_REF="$(git rev-parse HEAD)" \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t polkadotstorage.azurecr.io/storagext-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
-t storagext-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" \
--file ./docker/dockerfiles/storagext-cli.Dockerfile \
.

Expand All @@ -120,27 +122,27 @@ build-docker-all: build-polka-storage-node-docker build-polka-storage-provider-c
# Run the mater CLI docker image
# This only works if the image is already built
run-mater-docker:
docker run -it polkadotstorage.azurecr.io/mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
docker run -it mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"

# Run the parachain node docker image
# This only works if the image is already built
run-polka-storage-node-docker:
docker run -it polkadotstorage.azurecr.io/parachain-node:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
docker run -it parachain-node:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"

# Run the storage provider client docker image
# This only works if the image is already built
run-polka-storage-client-docker:
docker run -it polkadotstorage.azurecr.io/sp-client:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
docker run -it sp-client:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"

# Run the storage provider server docker image
# This only works if the image is already built
run-polka-storage-server-docker:
docker run -it polkadotstorage.azurecr.io/sp-server:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
docker run -it sp-server:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"

# Run the storagext CLI docker image
# This only works if the image is already built
run-storagext-docker:
docker run -it polkadotstorage.azurecr.io/storagext-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
docker run -it storagext-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"

load-to-minikube:
# https://github.com/paritytech/zombienet/pull/1830
Expand Down

0 comments on commit d71b7bf

Please sign in to comment.