Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push image to ECR #12

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 42 additions & 31 deletions .github/workflows/push-container.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
name: Publish refresh service
name: Push refresh service to AWS ECR

on:
workflow_dispatch:
push:
branches:
- main

env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_PRIVADO_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION_PRIVADO_ID }}
ECR_REPOSITORY: refresh_service

jobs:
build_refresh_service:
runs-on: ubuntu-22.04
deploy:
environment:
name: ${{ github.ref_name }}
name: Build and deploy refresh service to AWS ECR
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: actions/setup-node@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install zip and wget utils
run: mkdir ./circuits && sudo apt-get install -y zip unzip wget
node-version: 16

- name: Get current branch name
id: branch-name
uses: tj-actions/branch-names@v7

- name: Download latest circuits 'latest.zip' from S3
if: steps.specific_circuits.outcome != 'success'
run: wget https://iden3-circuits-bucket.s3.eu-west-1.amazonaws.com/latest.zip -P ./circuits
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession

- name: Unzip circuits to folder
if: steps.specific_circuits.outcome != 'success'
run: cd circuits && unzip latest.zip && cd - && pwd
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version

- name: build and deploy to ghcr.io
- name: Build with tag and push image
env:
GITHUB_REF: ${{ github.ref}}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
docker buildx build --push \
--platform linux/amd64 \
-t ghcr.io/0xpolygonid/refresh-service:${ref} -t ghcr.io/0xpolygonid/refresh-service:dev .
docker build \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} .

docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,13 @@ linters:
- revive
- govet
- unconvert
- structcheck
- gas
- gocyclo
- dupl
- misspell
- unparam
- varcheck
- deadcode
- typecheck
- ineffassign
- varcheck
- stylecheck
- gochecknoinits
- exportloopref
Expand Down
1 change: 1 addition & 0 deletions packagemanager/packagemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (s *state) verify(_ circuits.CircuitID, pubsignals []string) error {
return errors.Errorf("error getting global state info by state '%s': %v",
globalState, err)
}
// to process states from private networks
// if (big.NewInt(0)).Cmp(globalStateInfo.CreatedAtTimestamp) == 0 {
// return errors.Errorf("root %s doesn't exist in smart contract",
// globalState.String())
Expand Down
Loading