Skip to content

Commit

Permalink
GHA - Clean env vars and correct inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbown committed Oct 17, 2024
1 parent 0de8855 commit 7c3d6a4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 103 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
develop_tag:
required: true
type: string
push_image:
required: false
type: boolean
default: false
coordinator_changed:
required: true
type: string
Expand Down Expand Up @@ -47,6 +51,7 @@ jobs:
commit_tag: ${{ inputs.commit_tag }}
develop_tag: ${{ inputs.develop_tag }}
image_name: consensys/linea-coordinator
push_image: ${{ inputs.push_image }}
secrets: inherit

prover:
Expand All @@ -56,6 +61,7 @@ jobs:
commit_tag: ${{ inputs.commit_tag }}
develop_tag: ${{ inputs.develop_tag }}
image_name: consensys/linea-prover
push_image: ${{ inputs.push_image }}
secrets: inherit

postman:
Expand All @@ -65,6 +71,7 @@ jobs:
commit_tag: ${{ inputs.commit_tag }}
develop_tag: ${{ inputs.develop_tag }}
image_name: consensys/linea-postman
push_image: ${{ inputs.push_image }}
secrets: inherit

traces-api-facade:
Expand All @@ -74,4 +81,5 @@ jobs:
commit_tag: ${{ inputs.commit_tag }}
develop_tag: ${{ inputs.develop_tag }}
image_name: consensys/linea-traces-api-facade
push_image: ${{ inputs.push_image }}
secrets: inherit
22 changes: 8 additions & 14 deletions .github/workflows/coordinator-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,17 @@ jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
name: Coordinator build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
DEVELOP_TAG: ${{ inputs.develop_tag }}
IMAGE_NAME: ${{ inputs.image_name }}
PUSH_IMAGE: ${{ inputs.push_image }}
TAGS: ${{ inputs.image_name }}:${{ inputs.commit_tag }}
steps:
- name: Set environment variables for workflow_call
if: ${{ github.event_name == 'pull_request' }}
- name: Set develop tag if main branch
if: ${{ github.ref != 'refs/heads/main' }}
run: |
echo "COMMIT_TAG=${{ inputs.commit_tag }}" >> $GITHUB_ENV
echo "DEVELOP_TAG=${{ inputs.develop_tag }}" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }},${{ inputs.image_name }}:${{ inputs.develop_tag }}" >> $GITHUB_ENV
- name: Set environment variables for manual workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
echo DEVELOP_TAG=develop >> $GITHUB_ENV
echo "IMAGE_NAME=consensys/linea-traces-api-facade" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,12 @@ jobs:
e2e-tests-logs-dump: true
secrets: inherit

tag-after-run-tests-success:
needs: [ store-image-name-and-tags, testing, run-e2e-tests, run-e2e-tests-geth-tracing ]
if: ${{ always() && needs.testing.result == 'success' && needs.run-e2e-tests.outputs.tests_outcome == 'success' && needs.run-e2e-tests-geth-tracing.outputs.tests_outcome == 'success' }}
uses: ./.github/workflows/reuse-tag-with-develop.yml
with:
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
develop_tag: ${{ needs.store-image-name-and-tags.outputs.develop_tag }}
image_names: '["consensys/linea-coordinator", "consensys/linea-postman", "consensys/linea-prover", "consensys/linea-traces-api-facade"]'
secrets: inherit

publish-images-after-run-tests-success:
publish-images-after-run-tests-success-on-main:
needs: [ store-image-name-and-tags, testing, run-e2e-tests, run-e2e-tests-geth-tracing, tag-after-run-tests-success ]
if: ${{ always() && github.ref == 'refs/heads/main' && needs.testing.result == 'success' && needs.run-e2e-tests.outputs.tests_outcome == 'success' && needs.run-e2e-tests-geth-tracing.outputs.tests_outcome == 'success' }}
uses: ./.github/workflows/build-and-publish.yml
with:
push_image: 'true'
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
develop_tag: ${{ needs.store-image-name-and-tags.outputs.develop_tag }}
coordinator_changed: ${{ needs.filter-commit-changes.outputs.coordinator }}
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/postman-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,17 @@ jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
name: Postman build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
DEVELOP_TAG: ${{ inputs.develop_tag }}
IMAGE_NAME: ${{ inputs.image_name }}
PUSH_IMAGE: ${{ inputs.push_image }}
TAGS: ${{ inputs.image_name }}:${{ inputs.commit_tag }}
steps:
- name: Set environment variables for workflow_call
if: ${{ github.event_name == 'pull_request' }}
- name: Set develop tag if main branch
if: ${{ github.ref != 'refs/heads/main' }}
run: |
echo "COMMIT_TAG=${{ inputs.commit_tag }}" >> $GITHUB_ENV
echo "DEVELOP_TAG=${{ inputs.develop_tag }}" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }},${{ inputs.image_name }}:${{ inputs.develop_tag }}" >> $GITHUB_ENV
- name: Set environment variables for manual workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
echo DEVELOP_TAG=develop >> $GITHUB_ENV
echo "IMAGE_NAME=consensys/linea-traces-api-facade" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/prover-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,17 @@ jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
name: Prover build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
DEVELOP_TAG: ${{ inputs.develop_tag }}
IMAGE_NAME: ${{ inputs.image_name }}
PUSH_IMAGE: ${{ inputs.push_image }}
TAGS: ${{ inputs.image_name }}:${{ inputs.commit_tag }}
steps:
- name: Set environment variables for workflow_call
if: ${{ github.event_name == 'pull_request' }}
- name: Set develop tag if main branch
if: ${{ github.ref != 'refs/heads/main' }}
run: |
echo "COMMIT_TAG=${{ inputs.commit_tag }}" >> $GITHUB_ENV
echo "DEVELOP_TAG=${{ inputs.develop_tag }}" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }},${{ inputs.image_name }}:${{ inputs.develop_tag }}" >> $GITHUB_ENV
- name: Set environment variables for manual workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
echo DEVELOP_TAG=develop >> $GITHUB_ENV
echo "IMAGE_NAME=consensys/linea-traces-api-facade" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/reuse-tag-with-develop.yml

This file was deleted.

22 changes: 8 additions & 14 deletions .github/workflows/traces-api-facade-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,17 @@ jobs:
build-and-publish:
runs-on: [self-hosted, ubuntu-20.04, X64, small]
name: Traces api facade build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
DEVELOP_TAG: ${{ inputs.develop_tag }}
IMAGE_NAME: ${{ inputs.image_name }}
PUSH_IMAGE: ${{ inputs.push_image }}
TAGS: ${{ inputs.image_name }}:${{ inputs.commit_tag }}
steps:
- name: Set environment variables for workflow_call
if: ${{ github.event_name == 'pull_request' }}
- name: Set develop tag if main branch
if: ${{ github.ref != 'refs/heads/main' }}
run: |
echo "COMMIT_TAG=${{ inputs.commit_tag }}" >> $GITHUB_ENV
echo "DEVELOP_TAG=${{ inputs.develop_tag }}" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }},${{ inputs.image_name }}:${{ inputs.develop_tag }}" >> $GITHUB_ENV
- name: Set environment variables for manual workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
echo DEVELOP_TAG=develop >> $GITHUB_ENV
echo "IMAGE_NAME=inputs.image_name" >> $GITHUB_ENV
echo "PUSH_IMAGE=${{ inputs.push_image }}" >> $GITHUB_ENV
echo "TAGS=${{ inputs.image_name }}:${{ inputs.commit_tag }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 7c3d6a4

Please sign in to comment.