Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chain-spec-builder docker image #4655

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
options:
- polkadot
- polkadot-parachain
- chain-spec-builder

release_id:
description: |
Expand Down Expand Up @@ -74,7 +75,7 @@ env:

jobs:
fetch-artifacts: # this job will be triggered for the polkadot-parachain rc and release or polkadot rc image build
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.image_type == 'rc' }}
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'chain-spec-builder' || inputs.image_type == 'rc' }}
runs-on: ubuntu-latest

steps:
Expand All @@ -97,7 +98,7 @@ jobs:

- name: Fetch rc artifacts or release artifacts from s3 based on version
#this step runs only if the workflow is triggered manually
if: ${{ env.EVENT_NAME == 'workflow_dispatch' }}
if: ${{ env.EVENT_NAME == 'workflow_dispatch' && inputs.binary != 'chain-spec-builder'}}
run: |
. ./.github/scripts/common/lib.sh

Expand All @@ -106,6 +107,14 @@ jobs:

fetch_release_artifacts_from_s3

- name: Fetch chain-spec-builder rc artifacts or release artifacts based on release id
#this step runs only if the workflow is triggered manually and only for chain-spec-builder
if: ${{ env.EVENT_NAME == 'workflow_dispatch' && inputs.binary == 'chain-spec-builder' }}
run: |
. ./.github/scripts/common/lib.sh
RELEASE_ID=$(check_release_id "${{ inputs.release_id }}")
fetch_release_artifacts

- name: Cache the artifacts
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
Expand All @@ -114,7 +123,7 @@ jobs:
./release-artifacts/${{ env.BINARY }}/**/*

build-container: # this job will be triggered for the polkadot-parachain rc and release or polkadot rc image build
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.image_type == 'rc' }}
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'chain-spec-builder' || inputs.image_type == 'rc' }}
runs-on: ubuntu-latest
needs: fetch-artifacts
environment: release
Expand All @@ -132,6 +141,7 @@ jobs:
./release-artifacts/${{ env.BINARY }}/**/*

- name: Check sha256 ${{ env.BINARY }}
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'polkadot' }}
working-directory: ./release-artifacts/${{ env.BINARY }}
run: |
. ../../.github/scripts/common/lib.sh
Expand All @@ -140,6 +150,7 @@ jobs:
check_sha256 $BINARY && echo "OK" || echo "ERR"

- name: Check GPG ${{ env.BINARY }}
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'polkadot' }}
working-directory: ./release-artifacts/${{ env.BINARY }}
run: |
. ../../.github/scripts/common/lib.sh
Expand Down Expand Up @@ -169,13 +180,14 @@ jobs:
id: fetch_release_refs
run: |
chmod a+rx $BINARY
VERSION=$(./$BINARY --version | awk '{ print $2 }' )
[[ $BINARY != 'chain-spec-builder' ]] && VERSION=$(./$BINARY --version | awk '{ print $2 }' )

release=$( echo $VERSION | cut -f1 -d- )
echo "tag=latest" >> $GITHUB_OUTPUT
echo "release=${release}" >> $GITHUB_OUTPUT

- name: Build Injected Container image for polkadot rc
if: ${{ env.BINARY == 'polkadot' }}
- name: Build Injected Container image for polkadot rc or chain-spec-builder
if: ${{ env.BINARY == 'polkadot' || env.BINARY == 'chain-spec-builder' }}
env:
ARTIFACTS_FOLDER: ./release-artifacts
IMAGE_NAME: ${{ env.BINARY }}
Expand Down Expand Up @@ -219,7 +231,11 @@ jobs:
RELEASE_TAG: ${{ steps.fetch_rc_refs.outputs.release || steps.fetch_release_refs.outputs.release }}
run: |
echo "Checking tag ${RELEASE_TAG} for image ${REGISTRY}/${DOCKER_OWNER}/${BINARY}"
$ENGINE run -i ${REGISTRY}/${DOCKER_OWNER}/${BINARY}:${RELEASE_TAG} --version
if [[ ${BINARY} == 'chain-spec-builder' ]]; then
$ENGINE run -i ${REGISTRY}/${DOCKER_OWNER}/${BINARY}:${RELEASE_TAG}
else
$ENGINE run -i ${REGISTRY}/${DOCKER_OWNER}/${BINARY}:${RELEASE_TAG} --version
fi

fetch-latest-debian-package-version: # this job will be triggered for polkadot release build
if: ${{ inputs.binary == 'polkadot' && inputs.image_type == 'release' }}
Expand Down
2 changes: 1 addition & 1 deletion docker/dockerfiles/binary_injected.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LABEL io.parity.image.authors=${AUTHORS} \
USER root
WORKDIR /app

# add polkadot binary to docker image
# add binary to docker image
# sample for polkadot: COPY ./polkadot ./polkadot-*-worker /usr/local/bin/
COPY entrypoint.sh .
COPY "bin/*" "/usr/local/bin/"
Expand Down
14 changes: 14 additions & 0 deletions docker/scripts/chain-spec-builder/build-injected.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Sample call:
# $0 /path/to/folder_with_binary
# This script replace the former dedicated Dockerfile
# and shows how to use the generic binary_injected.dockerfile

PROJECT_ROOT=`git rev-parse --show-toplevel`

export BINARY=chain-spec-builder
export ARTIFACTS_FOLDER=$1
# export TAGS=...

$PROJECT_ROOT/docker/scripts/build-injected.sh
19 changes: 19 additions & 0 deletions docker/scripts/chain-spec-builder/test-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

TMP=$(mktemp -d)
ENGINE=${ENGINE:-podman}

export TAGS=latest,beta,7777,1.0.2-rc23

# Fetch some binaries
$ENGINE run --user root --rm -i \
--pull always \
-v "$TMP:/export" \
--entrypoint /bin/bash \
parity/chain-spec-builder -c \
'cp "$(which chain-spec-builder)" /export'

echo "Checking binaries we got:"
ls -al $TMP

./build-injected.sh $TMP
Loading