Skip to content

Commit

Permalink
Merge branch 'main' into enhancement/org-enrichment-with-temporal-C-2905
Browse files Browse the repository at this point in the history
  • Loading branch information
Uroš Marolt committed Jan 9, 2024
2 parents 2f0cb0c + 46009da commit ec851f2
Show file tree
Hide file tree
Showing 63 changed files with 11,601 additions and 13,369 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/lf-production-deploy-new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
description: Deploy emails-worker service?
required: true
type: boolean
deploy_profiles_worker:
description: Deploy profiles-worker service?
required: true
type: boolean
deploy_members_enrichment_worker:
description: Deploy members-enrichment-worker service?
required: true
Expand Down Expand Up @@ -182,6 +186,27 @@ jobs:
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-profiles-worker:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_profiles_worker }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: profiles-worker

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-members-enrichment-worker:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_members_enrichment_worker }}
Expand Down Expand Up @@ -378,6 +403,24 @@ jobs:
image: ${{ needs.build-and-push-emails-worker.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-profiles-worker:
needs: build-and-push-profiles-worker
runs-on: ubuntu-latest
if: ${{ inputs.deploy_profiles_worker }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: profiles-worker
image: ${{ needs.build-and-push-profiles-worker.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-members-enrichment-worker:
needs: build-and-push-members-enrichment-worker
runs-on: ubuntu-latest
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/lf-staging-deploy-profiles-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: LF Staging Deploy Profiles Worker

on:
push:
branches:
- 'lf-staging/**'
- 'lf-staging-**'
paths:
- 'services/libs/**'
- 'services/apps/profiles_worker/**'

env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
CROWD_CLUSTER: ${{ secrets.LF_STAGING_CLUSTER_NAME }}
CROWD_ROLE_ARN: ${{ secrets.LF_STAGING_CLUSTER_ROLE_ARN }}
AWS_ACCESS_KEY_ID: ${{ secrets.LF_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.LF_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.LF_AWS_REGION }}
SLACK_CHANNEL: deploys-lf-staging
SLACK_WEBHOOK: ${{ secrets.LF_STAGING_SLACK_CHANNEL_HOOK }}

jobs:
build-and-push:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: profiles-worker

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

deploy-profiles-worker:
needs: build-and-push
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: profiles-worker
image: ${{ needs.build-and-push.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}
43 changes: 43 additions & 0 deletions .github/workflows/production-deploy-new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
description: Deploy emails-worker service?
required: true
type: boolean
deploy_profiles_worker:
description: Deploy profiles-worker service?
required: true
type: boolean
deploy_members_enrichment_worker:
description: Deploy members-enrichment-worker service?
required: true
Expand Down Expand Up @@ -182,6 +186,27 @@ jobs:
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-profiles-worker:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_profiles_worker }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: profiles-worker

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-members-enrichment-worker:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_members_enrichment_worker }}
Expand Down Expand Up @@ -378,6 +403,24 @@ jobs:
image: ${{ needs.build-and-push-emails-worker.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-profiles-worker:
needs: build-and-push-profiles-worker
runs-on: ubuntu-latest
if: ${{ inputs.deploy_profiles_worker }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: profiles-worker
image: ${{ needs.build-and-push-profiles-worker.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-members-enrichment-worker:
needs: build-and-push-members-enrichment-worker
runs-on: ubuntu-latest
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/staging-deploy-profiles-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Staging Deploy Profiles Worker

on:
push:
branches:
- 'staging/**'
- 'staging-**'
paths:
- 'services/libs/**'
- 'services/apps/profiles_worker/**'

env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
CROWD_CLUSTER: ${{ secrets.STAGING_CLUSTER_NAME }}
CROWD_ROLE_ARN: ${{ secrets.STAGING_CLUSTER_ROLE_ARN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SLACK_CHANNEL: deploys-staging
SLACK_WEBHOOK: ${{ secrets.STAGING_SLACK_CHANNEL_HOOK }}

jobs:
build-and-push:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: profiles-worker

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

deploy-profiles-worker:
needs: build-and-push
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: profiles-worker
image: ${{ needs.build-and-push.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
DO $$
DECLARE
_member_id UUID;
_first_acitivity TIMESTAMP;
BEGIN
FOR _member_id IN
SELECT id
FROM members
WHERE EXTRACT(YEAR FROM "joinedAt") = 1970 -- those who have the wrong joinedAt
AND EXISTS ( -- yet have at least one activity with a non-1970 timestamp
SELECT 1
FROM activities a
WHERE a."memberId" = members.id
AND EXTRACT(YEAR FROM a.timestamp) != 1970
)
LOOP
RAISE NOTICE 'member_id: %', _member_id;

-- find the actual first non-1970 activity timestamp
SELECT MIN(a.timestamp) INTO _first_acitivity
FROM activities a
WHERE EXTRACT(YEAR FROM a.timestamp) != 1970
AND a."memberId" = _member_id;

IF _first_acitivity IS NULL THEN
CONTINUE;
END IF;

RAISE NOTICE 'first_acitivity: %', _first_acitivity;

UPDATE members
SET "joinedAt" = _first_acitivity
WHERE id = _member_id;
END LOOP;
END;
$$;
Loading

0 comments on commit ec851f2

Please sign in to comment.