fix: use cognee-ci-cd role

This commit is contained in:
Boris Arzentar 2024-09-24 20:19:49 +02:00
parent 0b47a703f9
commit 6dde336169

View file

@ -9,7 +9,7 @@ on:
- '**.md' - '**.md'
env: env:
AWS_ROLE_DEV_CICD: "arn:aws:iam::463722570299:role/promethai-dev-base-role-github-ci-cd" AWS_ROLE_DEV_CICD: "arn:aws:iam::463722570299:role/cognee-ci-cd"
AWS_ACCOUNT_ID_DEV: "463722570299" AWS_ACCOUNT_ID_DEV: "463722570299"
jobs: jobs:
@ -22,7 +22,8 @@ jobs:
contents: read contents: read
steps: steps:
- name: Checkout code from repo - name: Checkout code from repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set environment variable for stage - name: Set environment variable for stage
id: set-env id: set-env
run: | run: |
@ -33,13 +34,16 @@ jobs:
echo "STAGE=dev" >> $GITHUB_ENV echo "STAGE=dev" >> $GITHUB_ENV
echo "::set-output name=stage::dev" echo "::set-output name=stage::dev"
fi fi
- name: Use output - name: Use output
run: echo "The stage is ${{ steps.set-env.outputs.stage }}" run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
- name: Configure AWS credentials - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v4
with: with:
role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }} role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
aws-region: eu-west-1 aws-region: eu-west-1
- name: Build Docker image and push to ECR - name: Build Docker image and push to ECR
uses: ./.github/actions/image_builder uses: ./.github/actions/image_builder
id: build-cognee-docker-image id: build-cognee-docker-image
@ -49,22 +53,24 @@ jobs:
should_publish: true should_publish: true
ecr_image_repo_name: cognee-dev-backend-cognee-api/cognee-dev ecr_image_repo_name: cognee-dev-backend-cognee-api/cognee-dev
dockerfile_location: ./ dockerfile_location: ./
- name: Export Cognee image tag - name: Export Cognee image tag
id: export-cognee-image-tag id: export-cognee-image-tag
run: | run: |
export IMAGE_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION) export IMAGE_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
echo "Docker tag is: $IMAGE_TAG" echo "Docker tag is: $IMAGE_TAG"
echo "cognee_image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT echo "cognee_image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
outputs: outputs:
cognee_image_tag: ${{ steps.export-cognee-image-tag.outputs.cognee_image_tag }} cognee_image_tag: ${{ steps.export-cognee-image-tag.outputs.cognee_image_tag }}
apply_tf: trigger_deployment:
name: Trigger terraform apply workflow name: Trigger deployment
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: publish_docker_to_ecr needs: publish_docker_to_ecr
steps: steps:
- name: TF apply workflow triggers step - name: Trigger deployment in the infrastructure
uses: actions/github-script@v6 uses: actions/github-script@v7
with: with:
github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
script: | script: |