Skip to content

Commit 47635e2

Browse files
committed
fix reusable workflow call
1 parent c99f8bf commit 47635e2

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed
Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
1-
name: Reusable build and deploy to ecr workflow
1+
name: Reusable build and deploy to ECR workflow
22

33
on:
44
workflow_call:
55
inputs:
6-
aws-region:
7-
required: true
8-
type: string
9-
ecr-repo-name:
10-
required: true
11-
type: string
12-
image-tag:
13-
required: true
14-
type: string
6+
aws-region:
7+
required: true
8+
type: string
9+
ecr-repo-name:
10+
required: true
11+
type: string
12+
image-tag:
13+
required: true
14+
type: string
1515
secrets:
1616
AWS_ACCESS_KEY_ID:
1717
required: true
1818
AWS_SECRET_ACCESS_KEY:
1919
required: true
2020

21-
2221
jobs:
2322
build-images-and-push-to-ecr:
2423
runs-on: ubuntu-latest
2524
steps:
26-
- name: Checkout
25+
- name: Checkout Repository
2726
uses: actions/checkout@v4
28-
- name: Configure AWS credentials
27+
28+
- name: Configure AWS Credentials
2929
uses: aws-actions/configure-aws-credentials@v1
3030
with:
3131
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
3232
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33-
aws-region: ${{ input.aws-region }}
34-
env:
35-
ECR_REPOSITORY: ${{ input.ecr-repo-name }}
36-
IMAGE_TAG: ${{ input.image-tag }}
37-
33+
aws-region: ${{ inputs.aws-region }}
34+
3835
- name: Login to Amazon ECR
3936
id: login-ecr
4037
uses: aws-actions/amazon-ecr-login@v1
4138

42-
- name: Build, tag, and push image to Amazon ECR
39+
- name: Build, Tag, and Push Image to Amazon ECR
4340
id: build-image
4441
working-directory: src/validation_lambda
4542
env:
4643
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
44+
ECR_REPOSITORY: ${{ inputs.ecr-repo-name }}
45+
IMAGE_TAG: ${{ inputs.image-tag }}
4746
run: |
48-
# Build a docker container and
49-
# push it to ECR to be used in lambda.
47+
echo "Building Docker image..."
5048
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
49+
echo "Pushing image to ECR..."
5150
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
52-
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
51+
echo "Image successfully pushed: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

.github/workflows/workflow.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020
- name: Run tests
2121
run: uv run pytest tests
2222

23-
build-ecr-images:
24-
runs-on: ubuntu-latest
23+
build-validation-lambda-ecr:
2524
needs: test
26-
steps:
27-
- name: validation lambda
28-
uses: heaven00/fraud-detection-aws/.github/workflows/build_and_deploy_images.yml@main
29-
with:
30-
aws-region: ca-central-1
31-
ecr-repo-name: fraud-detection/validation-lambda
32-
image-tag: ${{ github.sha }}
25+
uses: heaven00/fraud-detection-aws/.github/workflows/build_and_deploy_images.yml@main
26+
with:
27+
aws-region: ca-central-1
28+
ecr-repo-name: fraud-detection/validation-lambda
29+
image-tag: ${{ github.sha }}
30+
secrets:
31+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3333

0 commit comments

Comments
 (0)