Skip to content

bump substreams for another initial block alignment issue #1658

bump substreams for another initial block alignment issue

bump substreams for another initial block alignment issue #1658

Workflow file for this run

---
name: Build docker image
on:
push:
tags:
- "v*"
branches:
- "dockerbuild"
- "develop"
- "release/v*"
- "feature/*"
workflow_dispatch:
inputs:
flavors:
description: 'JSON-formatted list of flavors to build'
required: true
type: string
default: '[{"name":"geth","version":"latest-fh2"},{"name":"bsc","version":"latest-fh2"},{"name":"polygon","version":"latest-fh2"},{"name":"optimism","version":"latest-fh3"}]'
nitro_tag:
description: 'nitro docker image to pull (will not build if set to the string "null")'
required: true
type: string
default: 'latest'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
setup:
runs-on: ubuntu-latest
env:
SLACK_IDS: ${{ vars.SLACK_IDS }}
outputs:
slack_id: ${{ steps.get-slack-id.outputs.SLACK_ID }}
steps:
- name: Check SLACK_IDS env variable
run: |
if [ -z "${SLACK_IDS}" ]; then
echo "The secret 'vars.SLACK_IDS' is empty"
exit 1
fi
- name: Get Slack ID
id: get-slack-id
run: |
SLACK_IDS=$(echo "$SLACK_IDS" | sed 's/\\//g')
SLACK_ID=$(echo "$SLACK_IDS" | jq -r '.["${{ github.actor }}"]')
echo "SLACK_ID=$SLACK_ID" >> $GITHUB_OUTPUT
build-vanilla:
needs: [setup]
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- uses: actions/checkout@v3
- name: Branch name
id: extract_branch
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "release_train=$(echo ${GITHUB_REF#refs/heads/release/})" >> $GITHUB_OUTPUT
echo "core_version=$(grep 'github.com/streamingfast/firehose-core' go.mod | cut -d' ' -f2)" >> $GITHUB_OUTPUT
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate docker tags/labels from github build context
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=sha,prefix=,enable=true
type=raw,enable=${{ github.ref == 'refs/heads/develop' }},value=develop
type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args: |
VERSION=${{ github.event.ref }}
COREVERSION=${{ steps.extract_branch.outputs.core_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Get Job ID from GH API
id: get_job_id
if: ${{ failure() }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jobs=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo "$jobs" | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: Notify build failure on Slack
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:x: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Failed building docker image from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}, <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{ steps.get_job_id.outputs.job_id }}|See Actions Logs>) :broken_heart:
bundle-docker-version-nitro:
needs: [setup, build-vanilla]
runs-on: ubuntu-20.04
if: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, 'build:all') || github.event_name == 'workflow_dispatch') && (github.event.inputs.nitro_tag != 'null') }}
outputs:
nitro: ${{ steps.print.outputs.nitro }}
permissions:
contents: read
packages: write
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Branch name
id: extract_branch
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "release_train=$(echo ${GITHUB_REF#refs/heads/release/})" >> $GITHUB_OUTPUT
- run: |
docker pull ghcr.io/streamingfast/nitro:${{ github.event.inputs.nitro_tag == '' && 'latest' || github.event.inputs.nitro_tag }}
echo VERSION=$(docker inspect --format='{{index .Config.Labels "org.opencontainers.image.version"}}' 'ghcr.io/streamingfast/nitro:${{ github.event.inputs.nitro_tag == '' && 'latest' || github.event.inputs.nitro_tag }}') >> $GITHUB_ENV
echo SF_VERSION=$(echo "${{ needs.build-vanilla.outputs.tags }}" | grep -Ev "(develop|0.1[01].x)" | head -n 1 |cut -d: -f2) >> $GITHUB_ENV
- name: Generate docker tags/labels from github build context
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag,suffix=-nitro-${{ env.VERSION }}
type=ref,event=tag,suffix=-nitro
type=sha,prefix=,suffix=-nitro-${{ env.VERSION }},enable=true
type=sha,prefix=,suffix=-nitro,enable=true
type=raw,prefix=,suffix=-nitro-${{ env.VERSION }},enable=${{ github.ref == 'refs/heads/develop' }},value=develop
type=raw,prefix=,suffix=-nitro,enable=${{ github.ref == 'refs/heads/develop' }},value=develop
type=raw,prefix=,suffix=-nitro-${{ env.VERSION }},enable=${{ github.ref == 'refs/heads/dockerbuild' }},value=manual
type=raw,prefix=,suffix=-nitro,enable=${{ github.ref == 'refs/heads/dockerbuild' }},value=manual
type=raw,prefix=,suffix=-nitro-${{ env.VERSION }},enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }}
type=raw,prefix=,suffix=-nitro,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }}
flavor: latest=false
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile.nitro
build-args: |
VERSION=${{ github.event.ref }}
CHAIN_DOCKER_VERSION=${{ env.VERSION }}
SF_VERSION=${{ env.SF_VERSION }}
- name: Get Job ID from GH API
id: get_job_id
if: ${{ failure() }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jobs=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo "$jobs" | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: Notify build failure on Slack
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:x: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Failed building bundle for nitro from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}, <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{ steps.get_job_id.outputs.job_id }}|See Actions Logs>) :broken_heart:
- id: print
run: |
OUT="${{ steps.meta.outputs.tags }}"
OUT="${OUT//'%'/'%25'}"
OUT="${OUT//$'\n'/' '}"
OUT="${OUT//$'\r'/' '}"
echo "nitro=$OUT" >> $GITHUB_OUTPUT
bundle-docker-versions:
needs: [setup, build-vanilla]
runs-on: ubuntu-20.04
if: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, 'build:all') || github.event_name == 'workflow_dispatch') && (github.event.inputs.flavors == '' || contains(github.event.inputs.flavors, 'geth') || contains(github.event.inputs.flavors, 'polygon') || contains(github.event.inputs.flavors, 'bsc') || contains(github.event.inputs.flavors, 'optimism')) }}
permissions:
contents: read
packages: write
outputs:
geth: ${{ steps.print.outputs.geth }}
bsc: ${{ steps.print.outputs.bsc }}
polygon: ${{ steps.print.outputs.polygon }}
optimism: ${{ steps.print.outputs.optimism }}
strategy:
matrix:
binary: ${{ fromJSON( github.event.inputs.flavors || '[{"name":"geth","version":"latest-fh2"},{"name":"bsc","version":"latest-fh2"},{"name":"polygon","version":"latest-fh2"},{"name":"optimism","version":"latest-fh3"}]') }}
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Branch name
id: extract_branch
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "release_train=$(echo ${GITHUB_REF#refs/heads/release/})" >> $GITHUB_OUTPUT
- run: |
echo ${{ matrix }}
echo ${{ matrix.binary }}
echo ${{ matrix.binary.name }}
docker pull ghcr.io/streamingfast/go-ethereum:${{ matrix.binary.name }}-${{ matrix.binary.version }}
echo VERSION=$(docker inspect --format='{{index .Config.Labels "org.opencontainers.image.version"}}' 'ghcr.io/streamingfast/go-ethereum':${{ matrix.binary.name }}-${{ matrix.binary.version }}) >> $GITHUB_ENV
echo SF_VERSION=$(echo "${{ needs.build-vanilla.outputs.tags }}" | grep -Ev "(develop|0.1[01].x)" | head -n 1 |cut -d: -f2) >> $GITHUB_ENV
- name: Generate docker tags/labels from github build context
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag,suffix=-${{ env.VERSION }}
type=ref,event=tag,suffix=-${{ matrix.binary.name }}
type=sha,prefix=,suffix=-${{ env.VERSION }},enable=true
type=sha,prefix=,suffix=-${{ matrix.binary }},enable=true
type=raw,prefix=,suffix=-${{ env.VERSION }},enable=${{ github.ref == 'refs/heads/develop' }},value=develop
type=raw,prefix=,suffix=-${{ matrix.binary.name }},enable=${{ github.ref == 'refs/heads/develop' }},value=develop
type=raw,prefix=,suffix=-${{ env.VERSION }},enable=${{ github.ref == 'refs/heads/dockerbuild' }},value=manual
type=raw,prefix=,suffix=-${{ matrix.binary.name }},enable=${{ github.ref == 'refs/heads/dockerbuild' }},value=manual
type=raw,prefix=,suffix=-${{ env.VERSION }},enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }}
type=raw,prefix=,suffix=-${{ matrix.binary.name }},enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }}
flavor: latest=false
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile.bundle
build-args: |
CHAIN_DOCKER_REPO=ghcr.io/streamingfast/go-ethereum
CHAIN_DOCKER_VERSION=${{ env.VERSION }}
SF_VERSION=${{ env.SF_VERSION }}
- name: Get Job ID from GH API
id: get_job_id
if: ${{ failure() }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jobs=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo "$jobs" | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: Notify build failure on Slack
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:x: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Failed building docker versions from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}, <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{ steps.get_job_id.outputs.job_id }}|See Actions Logs>) :broken_heart:
- id: print
run: |
OUT="${{ steps.meta.outputs.tags }}"
OUT="${OUT//'%'/'%25'}"
OUT="${OUT//$'\n'/' '}"
OUT="${OUT//$'\r'/' '}"
echo "${{ matrix.binary.name }}=$OUT" >> $GITHUB_OUTPUT
slack-notifications-vanilla:
if: ${{ !startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, 'build:all') && github.event_name != 'workflow_dispatch' }}
needs: [setup, build-vanilla]
runs-on: ubuntu-20.04
steps:
- name: Slack notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:done: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Success building docker image from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build-vanilla.outputs.tags, ' ') }}```
slack-notifications:
needs: [ setup, build-vanilla, bundle-docker-versions ]
runs-on: ubuntu-20.04
steps:
- name: Slack notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:done: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Success building docker images from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build-vanilla.outputs.tags, ' ') }}
${{ needs.bundle-docker-versions.outputs.geth }}
${{ needs.bundle-docker-versions.outputs.bsc }}
${{ needs.bundle-docker-versions.outputs.optimism }}
${{ needs.bundle-docker-versions.outputs.polygon }}```
slack-notification-nitro:
needs: [ setup, bundle-docker-version-nitro ]
runs-on: ubuntu-20.04
steps:
- name: Slack notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: |
:done: <@${{ needs.setup.outputs.slack_id }}> *${{ github.repository }}* Success building nitro docker images from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build-vanilla.outputs.tags, ' ') }}
${{ needs.bundle-docker-version-nitro.outputs.nitro }}```