Skip to content

Commit

Permalink
ci: log in to the docker hub when possible (#312)
Browse files Browse the repository at this point in the history
* ci: docker hub login

* test

* fix: docker secrets issues

* fix: security build

* chore: disable steps if secrets are not defined

* chore: clean up

* chore: merge latest changes
  • Loading branch information
leovct authored Oct 22, 2024
1 parent ce8d2ee commit 38a979a
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

Expand Down Expand Up @@ -81,6 +93,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

Expand Down Expand Up @@ -149,6 +173,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

Expand Down Expand Up @@ -240,6 +276,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

Expand Down Expand Up @@ -297,6 +345,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,35 @@ env:
jobs:
# Deploy a standalone zkevm permisionless node against Cardona Sepolia Tesnet.
cardona-sepolia-testnet-pless-zkevm-node:
#if: github.repository == '0xPolygon/kurtosis-cdk' # Prevent this job to run on forks.
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Deploy the permisionless node
run: |
yq -Y --in-place '.args.l1_rpc_url = "${{ secrets.ALCHEMY_SEPOLIA_RPC_URL }}"' ./.github/tests/pless-zkevm-node/cardona-sepolia-testnet-pless-zkevm-node.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --args-file=./.github/tests/pless-zkevm-node/cardona-sepolia-testnet-pless-zkevm-node.yml --show-enclave-inspect=false .
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.ALCHEMY_SEPOLIA_RPC_URL}}
env:
ALCHEMY_SEPOLIA_RPC_URL: ${{ secrets.ALCHEMY_SEPOLIA_RPC_URL }}

- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/security-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
sonarcloud:
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.repository == '0xPolygon/kurtosis-cdk' # Prevent this job to run on forks.
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -21,3 +20,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.SONAR_TOKEN}}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 comments on commit 38a979a

Please sign in to comment.