Skip to content

Commit

Permalink
restore workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
valerii-kabisov-cll committed Sep 26, 2024
1 parent aeb037c commit 07325fe
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-publish-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "Push develop to private ECR"

on:
push:
branches:
- ccip-develop
workflow_dispatch:
inputs:
git_ref:
description: "Git ref (commit SHA, branch name, tag name, etc.) to checkout"
required: true
env:
GIT_REF: ${{ github.event.inputs.git_ref || github.ref }}

jobs:
push-ccip-develop:
runs-on: ubuntu-20.04
environment: build-develop
permissions:
id-token: write
contents: read
strategy:
matrix:
image:
- name: ""
dockerfile: core/chainlink.Dockerfile
tag-suffix: ""
- name: (plugins)
dockerfile: plugins/chainlink.Dockerfile
tag-suffix: -plugins
name: push-ccip-develop ${{ matrix.image.name }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ env.GIT_REF }}
# When this is ran from manual workflow_dispatch, the github.sha may be
# different than the checked out commit sha. The core build uses this
# commit sha as build metadata, so we need to make sure it's correct.
- name: Get checked out git ref
if: github.event.inputs.git_ref
id: git-ref
run: echo "checked-out=$(git rev-parse HEAD)" | tee -a "${GITHUB_OUTPUT}"
- name: Build, sign and publish ccip image
uses: ./.github/actions/build-sign-publish-chainlink
with:
publish: true
aws-role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }}
aws-region: ${{ secrets.AWS_REGION }}
ecr-hostname: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }}
ecr-image-name: ccip-develop
ecr-tag-suffix: ${{ matrix.image.tag-suffix }}
dockerfile: ${{ matrix.image.dockerfile }}
dockerhub_username: ${{ secrets.DOCKER_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKER_READONLY_PASSWORD }}
git-commit-sha: ${{ steps.git-ref.outputs.checked-out || github.sha }}

- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: push-ccip-develop ${{ matrix.image.name }}
continue-on-error: true
66 changes: 66 additions & 0 deletions .github/workflows/build-publish-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Build and Publish from PR"

##
# This workflow builds and publishes a Docker image for Chainlink from a PR.
# It has its own special IAM role, does not sign the image, and publishes to
# a special ECR repo.
##

on:
pull_request:

jobs:
build-publish-untrusted:
if: ${{ ! startsWith(github.ref_name, 'release/') || (! startsWith(github.head_ref, 'release/') && ! startsWith(github.ref_name, 'chore/'))}}
runs-on: ubuntu-20.04
environment: sdlc
permissions:
id-token: write
contents: read
env:
ECR_IMAGE_NAME: crib-ccip-untrusted
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- name: Git Short SHA
shell: bash
env:
GIT_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "GIT_SHORT_SHA=${GIT_PR_HEAD_SHA:0:7}" | tee -a "$GITHUB_ENV"
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@75a9005952a9e905649cfb5a6971fd9429436acd # v2.3.25
with:
repository: ${{ env.ECR_IMAGE_NAME}}
tag: sha-${{ env.GIT_SHORT_SHA }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}

- name: Build and publish chainlink image
if: steps.check-image.outputs.exists == 'false'
uses: ./.github/actions/build-sign-publish-chainlink
with:
publish: true
aws-role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}
aws-role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS_DEFAULT }}
aws-region: ${{ secrets.AWS_REGION }}
sign-images: false
ecr-hostname: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}
ecr-image-name: ${{ env.ECR_IMAGE_NAME }}
dockerhub_username: ${{ secrets.DOCKER_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKER_READONLY_PASSWORD }}

- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: build-chainlink-pr
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: build-publish-untrusted
continue-on-error: true
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Build Chainlink"

on:
pull_request:

jobs:
build-chainlink:
runs-on: ubuntu-20.04
if: ${{ ! startsWith(github.head_ref, 'release/') && ! startsWith(github.ref_name, 'chore/') }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: change
with:
predicate-quantifier: every
filters: |
changelog-only:
- 'CHANGELOG.md'
- '!common/**'
- '!contracts/**'
- '!core/**'
- '!crib/**'
- '!dashboard-lib/**'
- '!fuzz/**'
- '!integration-tests/**'
- '!internal/**'
- '!operator_ui/**'
- '!plugins/**'
- '!tools/**'
- name: Build chainlink image
if: ${{ steps.change.outputs.changelog-only == 'false' }}
uses: ./.github/actions/build-sign-publish-chainlink
with:
dockerhub_username: ${{ secrets.DOCKER_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKER_READONLY_PASSWORD }}
publish: false
sign-images: false

- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: build-chainlink
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: build-chainlink
continue-on-error: true

0 comments on commit 07325fe

Please sign in to comment.