Skip to content

Commit

Permalink
Revert "Delete staking miner (paritytech#1480)"
Browse files Browse the repository at this point in the history
This reverts commit 4b8bd90.
  • Loading branch information
btwiuse committed Sep 30, 2023
1 parent 4902db2 commit 7ccf41d
Show file tree
Hide file tree
Showing 27 changed files with 2,711 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ jobs:
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/staking-miner
if: ${{ env.BINARY == 'polkadot' || env.BINARY == 'staking-miner' }}
env:
ARTIFACTS_FOLDER: ./release-artifacts
IMAGE_NAME: ${{ env.BINARY }}
Expand Down
22 changes: 21 additions & 1 deletion .gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ build-malus:
- echo "polkadot-test-malus = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
- cp -r ./docker/* ./artifacts

build-staking-miner:
stage: build
extends:
- .docker-env
- .common-refs
# - .collect-artifacts
# DAG
needs:
- job: build-malus
artifacts: false
script:
- time cargo build -q --locked --release --package staging-staking-miner
# # pack artifacts
# - mkdir -p ./artifacts
# - mv ./target/release/staking-miner ./artifacts/.
# - echo -n "${CI_COMMIT_REF_NAME}" > ./artifacts/VERSION
# - echo -n "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" > ./artifacts/EXTRATAG
# - echo "staking-miner = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
# - cp -r ./scripts/* ./artifacts

build-rustdoc:
stage: build
extends:
Expand Down Expand Up @@ -347,7 +367,7 @@ build-subkey-linux:
extends: .build-subkey
# DAG
needs:
- job: build-malus
- job: build-staking-miner
artifacts: false
# tbd
# build-subkey-macos:
Expand Down
18 changes: 18 additions & 0 deletions .gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,24 @@ build-push-image-substrate-pr:
# # this artifact is used in zombienet-tests job
# dotenv: ./artifacts/malus.env

# publish-staking-miner-image:
# stage: publish
# extends:
# - .kubernetes-env
# - .build-push-image
# - .publish-refs
# variables:
# CI_IMAGE: ${BUILDAH_IMAGE}
# # scripts/ci/dockerfiles/staking-miner/staking-miner_injected.Dockerfile
# DOCKERFILE: ci/dockerfiles/staking-miner/staking-miner_injected.Dockerfile
# IMAGE_NAME: docker.io/paritytech/staking-miner
# GIT_STRATEGY: none
# DOCKER_USER: ${Docker_Hub_User_Parity}
# DOCKER_PASS: ${Docker_Hub_Pass_Parity}
# needs:
# - job: build-staking-miner
# artifacts: true

# substrate

# publish-substrate-image-pr:
Expand Down
120 changes: 115 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ members = [
"polkadot/statement-table",
"polkadot/utils/generate-bags",
"polkadot/utils/remote-ext-tests/bags-list",
"polkadot/utils/staking-miner",
"polkadot/xcm",
"polkadot/xcm/pallet-xcm",
"polkadot/xcm/pallet-xcm-benchmarks",
Expand Down
46 changes: 46 additions & 0 deletions docker/dockerfiles/staking-miner/staking-miner_builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM paritytech/ci-linux:production as builder

# metadata
ARG VCS_REF
ARG BUILD_DATE
ARG IMAGE_NAME="staking-miner"
ARG PROFILE=release

LABEL description="This is the build stage. Here we create the binary."

WORKDIR /app
COPY . /app
RUN cargo build --locked --$PROFILE --package staking-miner

# ===== SECOND STAGE ======

FROM docker.io/library/ubuntu:20.04
LABEL description="This is the 2nd stage: a very small image where we copy the binary."
LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="${IMAGE_NAME} for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/ci/dockerfiles/${IMAGE_NAME}/${IMAGE_NAME}_builder.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"

ARG PROFILE=release
COPY --from=builder /app/target/$PROFILE/staking-miner /usr/local/bin

RUN useradd -u 1000 -U -s /bin/sh miner && \
rm -rf /usr/bin /usr/sbin

# show backtraces
ENV RUST_BACKTRACE 1

USER miner

ENV SEED=""
ENV URI="wss://rpc.polkadot.io"
ENV RUST_LOG="info"

# check if the binary works in this container
RUN /usr/local/bin/staking-miner --version

ENTRYPOINT [ "/usr/local/bin/staking-miner" ]
43 changes: 43 additions & 0 deletions docker/dockerfiles/staking-miner/staking-miner_injected.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM docker.io/library/ubuntu:20.04

# metadata
ARG VCS_REF
ARG BUILD_DATE
ARG IMAGE_NAME="staking-miner"

LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="${IMAGE_NAME} for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/ci/dockerfiles/${IMAGE_NAME}/${IMAGE_NAME}_injected.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"

# show backtraces
ENV RUST_BACKTRACE 1

# install tools and dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libssl1.1 \
ca-certificates && \
# apt cleanup
apt-get autoremove -y && \
apt-get clean && \
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
useradd -u 1000 -U -s /bin/sh miner

# add binary to docker image
COPY ./staking-miner /usr/local/bin

USER miner

ENV SEED=""
ENV URI="wss://rpc.polkadot.io"
ENV RUST_LOG="info"

# check if the binary works in this container
RUN /usr/local/bin/staking-miner --version

ENTRYPOINT [ "/usr/local/bin/staking-miner" ]
Loading

0 comments on commit 7ccf41d

Please sign in to comment.