Skip to content

Commit

Permalink
fix(api-deploy/action.yml): Write the PGP key correctly (#3099)
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Dec 6, 2023
1 parent c60d5de commit c1c45cb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .github/actions/api-deploy-ecs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,20 @@ runs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Write PGP key to a file
run: |
cat << EOF > sse_pgp_pkey
${{ inputs.sse_pgp_private_key }}
EOF
shell: bash

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
IMAGE_TAG: ${{ steps.ecr-tag-variable.outputs.tag }}
ECR_REPOSITORY: ${{ inputs.aws_ecr_repository_arn }}
DOCKER_BUILDKIT: '1'
run: |
echo "Load pgp private key"
cat <<< ${{ input.sse_pgp_private_key }} > sse_pgp_pkey
echo "Building docker image with URL: "
echo $ECR_REPOSITORY:$IMAGE_TAG
docker build --secret id=sse_pgp_pkey,src=./sse_pgp_pkey -t $ECR_REPOSITORY:$IMAGE_TAG -f api/Dockerfile --build-arg SAML_INSTALLED=1 --build-arg POETRY_OPTS="--with saml,auth-controller" .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-deploy-production-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
flagsmith_workflows_revision: v1.2.5
flagsmith_auth_controller_revision: v0.0.1
flagsmith_rbac_revision: v0.4.1
sse_pgp_private_key: ${{ secrets.SSE_PGP_PRIVATE_KEY }}

- name: Deploy task processor to Production
uses: ./.github/actions/task-processor-deploy-ecs
Expand All @@ -50,7 +51,6 @@ jobs:
aws_ecs_service_name: flagsmith-task-processor-svc-eu-west-2-bf77140
aws_task_definitions_directory_path: infrastructure/aws/production
api_ecr_image_url: ${{ steps.deploy-api.outputs.api_ecr_image_url }}
sse_pgp_private_key: ${{ secrets.SSE_PGP_PRIVATE_KEY }}

run-tests:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-deploy-staging-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
flagsmith_workflows_revision: v1.2.5
flagsmith_auth_controller_revision: v0.0.1
flagsmith_rbac_revision: v0.4.1
sse_pgp_private_key: ${{ secrets.SSE_PGP_PRIVATE_KEY }}

- name: Deploy task processor to Staging
uses: ./.github/actions/task-processor-deploy-ecs
Expand All @@ -51,7 +52,6 @@ jobs:
aws_ecs_service_name: flagsmith-task-processor-svc-eu-west-2-792c644
aws_task_definitions_directory_path: infrastructure/aws/staging
api_ecr_image_url: ${{ steps.deploy-api.outputs.api_ecr_image_url }}
sse_pgp_private_key: ${{ secrets.SSE_PGP_PRIVATE_KEY }}

run-tests:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
MIDDLEWARE.append("app_analytics.middleware.InfluxDBMiddleware")

if USE_POSTGRES_FOR_ANALYTICS:
if INFLUXDB_TOKEN:
if INFLUXDB_BUCKET:
raise RuntimeError("Cannot use both InfluxDB and Postgres for analytics")

MIDDLEWARE.append("app_analytics.middleware.APIUsageMiddleware")
Expand Down
3 changes: 1 addition & 2 deletions api/app_analytics/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def post(self, request, *args, **kwargs):
)
if settings.USE_POSTGRES_FOR_ANALYTICS:
track_feature_evaluation.delay(args=(request.environment.id, request.data))

if settings.INFLUXDB_TOKEN:
elif settings.INFLUXDB_TOKEN:
track_feature_evaluation_influxdb(request.environment.id, request.data)

return Response(status=status.HTTP_200_OK)
Expand Down

3 comments on commit c1c45cb

@vercel
Copy link

@vercel vercel bot commented on c1c45cb Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c1c45cb Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-flagsmith.vercel.app
docs-git-main-flagsmith.vercel.app
docs.bullet-train.io
docs.flagsmith.com

@vercel
Copy link

@vercel vercel bot commented on c1c45cb Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.