Skip to content

Commit

Permalink
Merge branch 'develop' into feat/add-new-variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b authored Dec 17, 2024
2 parents 086b109 + 40ef3e2 commit 1fe3735
Show file tree
Hide file tree
Showing 42 changed files with 1,276 additions and 295 deletions.
44 changes: 20 additions & 24 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,38 @@ on:
push:
branches:
- main
- develop
paths: ['apps/api/**', '.github/workflows/deploy-api.yml', 'package.json']

jobs:
build:
runs-on: ubuntu-latest
environment: alpha
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
name: Build and push API docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2
- name: Docker Login
uses: azure/docker-login@v2
with:
login-server: ${{ vars.ACR_REGISTRY_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

# - name: Build Docker image
# id: build
# env:
# ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
# ECR_REPOSITORY: ${{ vars.ECR_API_REPOSITORY }}
# run: |
# # Build a docker container and push it to ECR
# aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/api/Dockerfile .
# echo "Pushing image to ECR..."
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
# echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT
- name: Build Docker image
id: build
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: api
run: |
# Build a docker container and push it to ACR
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/web/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
# setup-database:
# needs: build
Expand Down
44 changes: 20 additions & 24 deletions .github/workflows/deploy-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- develop
paths:
[
'apps/platform/**',
Expand All @@ -15,37 +16,32 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: alpha
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
name: Build and push Platform docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2
- name: Docker Login
uses: azure/docker-login@v2
with:
login-server: ${{ vars.ACR_REGISTRY_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

# - name: Build Docker image
# id: build
# env:
# ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
# ECR_REPOSITORY: ${{ vars.ECR_PLATFORM_REPOSITORY }}
# run: |
# # Build a docker container and push it to ECR
# aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/platform/Dockerfile .
# echo "Pushing image to ECR..."
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
# echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT
- name: Build Docker image
id: build
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: platform
run: |
# Build a docker container and push it to ACR
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/platform/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
# deploy:
# needs: build
Expand Down
76 changes: 36 additions & 40 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,60 @@ on:
push:
branches:
- main
- develop
paths: ['apps/web/**', '.github/workflows/deploy-web.yml', 'package.json']

jobs:
build:
runs-on: ubuntu-latest
environment: alpha
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
name: Build and push Web docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
- name: Docker Login
uses: azure/docker-login@v2
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
login-server: ${{ vars.ACR_REGISTRY_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Build Docker image
id: build
env:
ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ vars.ECR_WEB_REPOSITORY }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: web
run: |
# Build a docker container and push it to ECR
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/web/Dockerfile .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT
# Build a docker container and push it to ACR
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/web/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
deploy:
needs: build
runs-on: ubuntu-latest
environment: alpha
name: Deploy Web docker image for release
# deploy:
# needs: build
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy Web docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4
# steps:
# - name: Checkout
# uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

- name: Force re-deploy task in service
id: force-redeploy
env:
ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.ECS_WEB_SERVICE }}
run: |
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
# - name: Force re-deploy task in service
# id: force-redeploy
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_WEB_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: Get all invitations of user to workspaces
type: http
seq: 3
}

get {
url: {{BASE_URL}}/api/workspace/invitations?page=0&limit=10
body: none
auth: bearer
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetches all the workspaces where the user is invited to.
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IsNotEmpty, IsOptional, IsString, Matches } from 'class-validator'
export class CreateEnvironment {
@IsString()
@IsNotEmpty()
@Matches(/^[a-zA-Z0-9-_]{1,64}$/)
name: string

@IsString()
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/environment/environment.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { UserModule } from '@/user/user.module'
import { UserService } from '@/user/service/user.service'
import { QueryTransformPipe } from '@/common/pipes/query.transform.pipe'
import { fetchEvents } from '@/common/event'
import { ValidationPipe } from '@nestjs/common'

describe('Environment Controller Tests', () => {
let app: NestFastifyApplication
Expand Down Expand Up @@ -65,7 +66,7 @@ describe('Environment Controller Tests', () => {
environmentService = moduleRef.get(EnvironmentService)
userService = moduleRef.get(UserService)

app.useGlobalPipes(new QueryTransformPipe())
app.useGlobalPipes(new ValidationPipe(), new QueryTransformPipe())

await app.init()
await app.getHttpAdapter().getInstance().ready()
Expand Down Expand Up @@ -184,7 +185,7 @@ describe('Environment Controller Tests', () => {
'x-e2e-user-email': user1.email
}
})

expect(response.statusCode).toBe(400)
expect(response.json().message).toContain('name should not be empty')
})
Expand Down
12 changes: 6 additions & 6 deletions apps/api/src/mail/emails/components/base-email-template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export const BaseEmailTemplate: React.FC<BaseEmailTemplateProps> = ({
<Heading style={h1}>{heading}</Heading>
{children}
<Text style={text}>
If you believe this action was taken in error or have any
questions regarding this change, please contact your project
administrator or our support team.
If you believe this action was taken in error or have any
questions regarding this change, please contact your project
administrator or our support team.
</Text>
<Text style={text}>
We appreciate your understanding and thank you for your
contributions to the project.
We appreciate your understanding and thank you for your
contributions to the project.
</Text>
<Text style={text}>
Cheers,
Expand Down Expand Up @@ -81,4 +81,4 @@ export const BaseEmailTemplate: React.FC<BaseEmailTemplateProps> = ({
)
}

export default BaseEmailTemplate
export default BaseEmailTemplate
15 changes: 6 additions & 9 deletions apps/api/src/mail/emails/workspace-invitation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@ export const WorkspaceInvitationEmail = ({
: 'You are Invited to Join the Workspace'

return (
<BaseEmailTemplate
previewText={previewText}
heading={previewText}
>
<BaseEmailTemplate previewText={previewText} heading={previewText}>
<Text style={text}>Dear User,</Text>
<Text style={text}>
We're excited to inform you that you've been invited to join a
workspace on Keyshade. Here are the details of your invitation:
We're excited to inform you that you've been invited to join a workspace
on Keyshade. Here are the details of your invitation:
</Text>
<Section style={workspaceDetails}>
<Text style={workspaceInfo}>
Expand All @@ -54,8 +51,8 @@ export const WorkspaceInvitationEmail = ({
</Text>
</Section>
<Text style={text}>
Join the project by clicking the button below - we're excited to
have you!
Join the project by clicking the button below - we're excited to have
you!
</Text>
<Button href={actionUrl} style={ctaButton}>
Get started
Expand All @@ -64,4 +61,4 @@ export const WorkspaceInvitationEmail = ({
)
}

export default WorkspaceInvitationEmail
export default WorkspaceInvitationEmail
6 changes: 3 additions & 3 deletions apps/api/src/mail/emails/workspace-removal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const RemovedFromWorkspaceEmail = ({
>
<Text style={text}>Dear User,</Text>
<Text style={text}>
We hope this email finds you well. We are writing to inform you
that your access to the following workspace has been removed:
We hope this email finds you well. We are writing to inform you that
your access to the following workspace has been removed:
</Text>
<Section style={workspaceDetails}>
<Text style={workspaceInfo}>
Expand All @@ -39,4 +39,4 @@ export const RemovedFromWorkspaceEmail = ({
)
}

export default RemovedFromWorkspaceEmail
export default RemovedFromWorkspaceEmail
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkspaceMember" ADD COLUMN "createdOn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
1 change: 1 addition & 0 deletions apps/api/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ model WorkspaceMember {
workspaceId String
invitationAccepted Boolean @default(false)
roles WorkspaceMemberRoleAssociation[]
createdOn DateTime @default(now())
@@unique([workspaceId, userId])
}
Expand Down
Loading

0 comments on commit 1fe3735

Please sign in to comment.