diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index 0271908f..280e8c8c 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -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 diff --git a/.github/workflows/deploy-platform.yml b/.github/workflows/deploy-platform.yml index 8ac2eeb5..53d98b55 100644 --- a/.github/workflows/deploy-platform.yml +++ b/.github/workflows/deploy-platform.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - develop paths: [ 'apps/platform/**', @@ -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 diff --git a/.github/workflows/deploy-web.yml b/.github/workflows/deploy-web.yml index 6af7f7f8..9cb2d184 100644 --- a/.github/workflows/deploy-web.yml +++ b/.github/workflows/deploy-web.yml @@ -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 diff --git a/api-collection/Workspace Controller/Get all invitations of user.bru b/api-collection/Workspace Controller/Get all invitations of user.bru new file mode 100644 index 00000000..7912da15 --- /dev/null +++ b/api-collection/Workspace Controller/Get all invitations of user.bru @@ -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. +} diff --git a/apps/api/src/environment/dto/create.environment/create.environment.ts b/apps/api/src/environment/dto/create.environment/create.environment.ts index ffa62e3f..ae2b7db8 100644 --- a/apps/api/src/environment/dto/create.environment/create.environment.ts +++ b/apps/api/src/environment/dto/create.environment/create.environment.ts @@ -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() diff --git a/apps/api/src/environment/environment.e2e.spec.ts b/apps/api/src/environment/environment.e2e.spec.ts index ad949f1c..607705ef 100644 --- a/apps/api/src/environment/environment.e2e.spec.ts +++ b/apps/api/src/environment/environment.e2e.spec.ts @@ -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 @@ -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() @@ -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') }) diff --git a/apps/api/src/mail/emails/components/base-email-template.tsx b/apps/api/src/mail/emails/components/base-email-template.tsx index 891ddfe0..07dcf422 100644 --- a/apps/api/src/mail/emails/components/base-email-template.tsx +++ b/apps/api/src/mail/emails/components/base-email-template.tsx @@ -42,13 +42,13 @@ export const BaseEmailTemplate: React.FC = ({ {heading} {children} - 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. - 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. Cheers, @@ -81,4 +81,4 @@ export const BaseEmailTemplate: React.FC = ({ ) } -export default BaseEmailTemplate \ No newline at end of file +export default BaseEmailTemplate diff --git a/apps/api/src/mail/emails/workspace-invitation.tsx b/apps/api/src/mail/emails/workspace-invitation.tsx index 37b4fc0f..5fab5df7 100644 --- a/apps/api/src/mail/emails/workspace-invitation.tsx +++ b/apps/api/src/mail/emails/workspace-invitation.tsx @@ -33,14 +33,11 @@ export const WorkspaceInvitationEmail = ({ : 'You are Invited to Join the Workspace' return ( - + Dear User, - 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:
@@ -54,8 +51,8 @@ export const WorkspaceInvitationEmail = ({
- 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!