mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
work out github ecr within lambda
This commit is contained in:
parent
2359131ff9
commit
813f6e0bf3
2 changed files with 14 additions and 23 deletions
15
.github/workflows/_deploy_lambda.yml
vendored
15
.github/workflows/_deploy_lambda.yml
vendored
|
|
@ -15,7 +15,7 @@ on:
|
|||
required: true
|
||||
type: string
|
||||
|
||||
ecr_repo_url:
|
||||
ecr_repo:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
|
|
@ -55,6 +55,17 @@ jobs:
|
|||
|
||||
- uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- uses: aws-actions/amazon-ecr-login@v2
|
||||
|
||||
- name: Resolve ECR repo URL
|
||||
id: repo
|
||||
env:
|
||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||
run: |
|
||||
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
||||
ECR_REPO_URL="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${{ inputs.ecr_repo }}"
|
||||
echo "ecr_repo_url=$ECR_REPO_URL" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: ${{ inputs.lambda_path }}
|
||||
run: terraform init -reconfigure
|
||||
|
|
@ -71,7 +82,7 @@ jobs:
|
|||
terraform plan \
|
||||
-var="stage=${{ inputs.stage }}" \
|
||||
-var="lambda_name=${{ inputs.lambda_name }}" \
|
||||
-var="ecr_repo_url=${{ inputs.ecr_repo_url }}" \
|
||||
-var="ecr_repo_url=${{ steps.repo.outputs.ecr_repo_url }}" \
|
||||
-var="image_digest=${{ inputs.image_digest }}" \
|
||||
-out=lambdaplan
|
||||
|
||||
|
|
|
|||
22
.github/workflows/deploy_terraform.yml
vendored
22
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -80,26 +80,6 @@ jobs:
|
|||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: ${{ secrets.DEV_AWS_REGION }}
|
||||
|
||||
# ============================================================
|
||||
# 2.5️⃣ Check Address2UPRN image outputs
|
||||
# ============================================================
|
||||
check_address2uprn_image:
|
||||
needs: address2uprn_image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Dump image outputs
|
||||
run: |
|
||||
echo "ECR repo URL:"
|
||||
echo "${{ needs.address2uprn_image.outputs.ecr_repo_url }}"
|
||||
echo
|
||||
echo "Image digest:"
|
||||
echo "${{ needs.address2uprn_image.outputs.image_digest }}"
|
||||
echo
|
||||
echo "Full image URI:"
|
||||
echo "${{ needs.address2uprn_image.outputs.ecr_repo_url }}@${{ needs.address2uprn_image.outputs.image_digest }}"
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 3️⃣ Deploy Address 2 UPRN Lambda
|
||||
# ============================================================
|
||||
|
|
@ -110,7 +90,7 @@ jobs:
|
|||
lambda_name: address2uprn
|
||||
lambda_path: infrastructure/terraform/lambda/address2UPRN
|
||||
stage: ${{ needs.determine_stage.outputs.stage }}
|
||||
ecr_repo_url: ${{ needs.address2uprn_image.outputs.ecr_repo_url }}
|
||||
ecr_repo: address2uprn-${{ needs.determine_stage.outputs.stage }}
|
||||
image_digest: ${{ needs.address2uprn_image.outputs.image_digest }}
|
||||
secrets:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue