Skip to content

Commit

Permalink
feat: publish rpc-proxy Dockerfile on tag (#1454)
Browse files Browse the repository at this point in the history
* feat: first commit

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor

* feat: file refactor
  • Loading branch information
freemanzMrojo authored Nov 4, 2024
1 parent 92100a2 commit c02b2ff
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 49 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Jobs on tag

on:
push:
tags:
- '*'

jobs:
npm-publish:
uses: ./.github/workflows/publish-sdk.yml
secrets: inherit

rpc-proxy-docker-publish:
uses: ./.github/workflows/rpc-proxy.yml
secrets: inherit
4 changes: 1 addition & 3 deletions .github/workflows/publish-sdk.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Publish NPM package

on:
push:
tags:
- '*'
workflow_call:

permissions:
contents: read
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/rpc-proxy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: RPC Proxy - Docker build, scan and push

on:
workflow_call:

permissions:
contents: read
packages: write
checks: write
actions: read

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: vechain/sdk-rpc-proxy

- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: .
file: docker/rpc-proxy/Dockerfile
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Split tags and get the first value for scanning
id: split-tags
run: echo "first-tag=$(echo '${{ steps.meta.outputs.tags }}' | cut -d',' -f1)" >> $GITHUB_OUTPUT

- name: Run Trivy Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ steps.split-tags.outputs.first-tag }}
format: 'table'
ignore-unfixed: true
exit-code: '1'
vuln-type: os,library
severity: CRITICAL,HIGH,MEDIUM
scanners: misconfig,vuln,secret
env:
# See https://github.com/aquasecurity/trivy/discussions/7538
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2

- name: Build and push
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
context: .
file: docker/rpc-proxy/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 1 addition & 2 deletions .github/workflows/rpc-proxy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
workflow_call:

jobs:
build:
name: Test RPC Proxy
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/rpc-proxy-vulnerability-scan.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/rpc-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:

jobs:
test:
if: github.ref != 'refs/tags/*'
uses: ./.github/workflows/rpc-proxy-test.yml
secrets: inherit

docker-vulnerability-check:
uses: ./.github/workflows/rpc-proxy-vulnerability-scan.yml
docker:
uses: ./.github/workflows/rpc-proxy-docker.yml
secrets: inherit



1 comment on commit c02b2ff

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
99.06% (4352/4393) 97.71% (1413/1446) 99.11% (896/904)
Title Tests Skipped Failures Errors Time
core 808 0 💤 0 ❌ 0 🔥 2m 6s ⏱️
network 734 0 💤 0 ❌ 0 🔥 4m 41s ⏱️
errors 42 0 💤 0 ❌ 0 🔥 15.369s ⏱️
logging 3 0 💤 0 ❌ 0 🔥 15.312s ⏱️
hardhat-plugin 19 0 💤 0 ❌ 0 🔥 51.577s ⏱️
aws-kms-adapter 23 0 💤 0 ❌ 0 🔥 1m 16s ⏱️
ethers-adapter 5 0 💤 0 ❌ 0 🔥 1m 5s ⏱️
rpc-proxy 37 0 💤 0 ❌ 0 🔥 58.084s ⏱️

Please sign in to comment.