Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kriptonian1 authored Jan 30, 2025
2 parents 388db5c + b442fe0 commit 3ab265a
Show file tree
Hide file tree
Showing 37 changed files with 1,438 additions and 140 deletions.
42 changes: 19 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
branches:
- main
- develop
workflow_dispatch:

jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
latestTag: ${{ github.ref == 'refs/heads/main' && 'latest' || 'experimental' }}
version: ${{ steps.fetch-tag.outputs.version }}
steps:
- name: Checkout
Expand Down Expand Up @@ -79,18 +79,17 @@ jobs:
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: api
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
run: |
# Build a docker container and push it to ACR
echo "Building image..."
docker build \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG \
-f ./apps/api/Dockerfile .
-f apps/api/Dockerfile .
# Push the image
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG" >> $GITHUB_OUTPUT
- name: Azure Login action
uses: azure/login@v2
Expand All @@ -105,14 +104,14 @@ jobs:
API_CONTAINER_RG: ${{ vars.API_CONTAINER_RG }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: api
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
with:
azcliversion: latest
inlineScript: |
az containerapp update \
--name $API_CONTAINER \
--resource-group $API_CONTAINER_RG \
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
migrate-api:
name: Apply Database Migrations
Expand Down Expand Up @@ -169,8 +168,8 @@ jobs:
sentry-cli releases new $VERSION
sentry-cli releases set-commits --auto $VERSION
sentry-cli releases deploys $VERSION new -e $ENVIRONMENT
sentry-cli sourcemaps inject dist
sentry-cli sourcemaps upload --release $VERSION -p $PROJECT dist
sentry-cli sourcemaps inject apps/api/dist
sentry-cli sourcemaps upload --release $VERSION -p $SENTRY_PROJECT apps/api/dist
deploy-platform:
needs: release
Expand All @@ -195,7 +194,6 @@ jobs:
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: platform
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
NEXT_PUBLIC_BACKEND_URL: ${{ vars.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_SENTRY_PLATFORM_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_PLATFORM_DSN }}
Expand All @@ -204,15 +202,15 @@ jobs:
NEXT_PUBLIC_SENTRY_ENVIRONMENT: ${{ needs.release.outputs.environment }}
run: |
# Build a docker container and push it to ACR
echo "Building image..."
docker build \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG \
--build-arg NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL \
-f ./apps/platform/Dockerfile .
-f apps/platform/Dockerfile .
# Push the image
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG" >> $GITHUB_OUTPUT
- name: Azure Login action
uses: azure/login@v2
Expand All @@ -227,14 +225,14 @@ jobs:
PLATFORM_CONTAINER_RG: ${{ vars.PLATFORM_CONTAINER_RG }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: platform
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
with:
azcliversion: latest
inlineScript: |
az containerapp update \
--name $PLATFORM_CONTAINER \
--resource-group $PLATFORM_CONTAINER_RG \
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
release-sentry-platform:
name: Sentry Platform
Expand Down Expand Up @@ -296,7 +294,6 @@ jobs:
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: web
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_MEASUREMENT_ID }}
NEXT_PUBLIC_SENTRY_WEB_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_WEB_DSN }}
Expand All @@ -305,19 +302,18 @@ jobs:
NEXT_PUBLIC_SENTRY_ENVIRONMENT: ${{ needs.release.outputs.environment }}
run: |
# Build a docker container and push it to ACR
echo "Building image..."
docker build \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION \
-t $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG \
--build-arg NEXT_PUBLIC_GOOGLE_ANALYTICS_MEASUREMENT_ID=$NEXT_PUBLIC_GOOGLE_ANALYTICS_MEASUREMENT_ID \
--build-arg NEXT_PUBLIC_SENTRY_WEB_DSN=$NEXT_PUBLIC_SENTRY_WEB_DSN \
--build-arg NEXT_PUBLIC_SENTRY_WEB_PROFILE_SAMPLE_RATE=$NEXT_PUBLIC_SENTRY_WEB_PROFILE_SAMPLE_RATE \
--build-arg NEXT_PUBLIC_SENTRY_WEB_TRACES_SAMPLE_RATE=$NEXT_PUBLIC_SENTRY_WEB_TRACES_SAMPLE_RATE \
--build-arg NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT \
-f ./apps/web/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG" >> $GITHUB_OUTPUT
- name: Azure Login action
uses: azure/login@v2
Expand All @@ -332,14 +328,14 @@ jobs:
WEB_CONTAINER_RG: ${{ vars.WEB_CONTAINER_RG }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: web
LATEST_TAG: ${{ needs.release.outputs.latestTag }}
VERSION: ${{ needs.release.outputs.version }}
with:
azcliversion: latest
inlineScript: |
az containerapp update \
--name $WEB_CONTAINER \
--resource-group $WEB_CONTAINER_RG \
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$LATEST_TAG
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:$VERSION
sentry-release-web:
name: Sentry Web
Expand Down
83 changes: 83 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
## [2.11.0-stage.1](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0...v2.11.0-stage.1) (2025-01-29)

### 🚀 Features

* **platform:** Add new design for slug ([#675](https://github.com/keyshade-xyz/keyshade/issues/675)) ([2b8985c](https://github.com/keyshade-xyz/keyshade/commit/2b8985c4725dbf062dc66acf560f8433ce5d87dc))

## [2.10.0](https://github.com/keyshade-xyz/keyshade/compare/v2.9.1...v2.10.0) (2025-01-28)

### 🚀 Features

* **api:** Secret rotation ([#652](https://github.com/keyshade-xyz/keyshade/issues/652)) ([ad9a808](https://github.com/keyshade-xyz/keyshade/commit/ad9a808ac6819c34b67ee77a1c86cb87b962d411))
* **platform:** Implement delete project ([#671](https://github.com/keyshade-xyz/keyshade/issues/671)) ([d243c89](https://github.com/keyshade-xyz/keyshade/commit/d243c89be2358f104ad893b5c955d814835aa8e8))
* **platform:** Improved UI of [secure] listing ([#655](https://github.com/keyshade-xyz/keyshade/issues/655)) ([b19de47](https://github.com/keyshade-xyz/keyshade/commit/b19de47bdbe5c098fd2c256d4d9b65989498786c))
* **platform:** Operate on environments ([#670](https://github.com/keyshade-xyz/keyshade/issues/670)) ([f45c5fa](https://github.com/keyshade-xyz/keyshade/commit/f45c5fa81728832f6ff74c5c26d52e00e32fb546))

### 🐛 Bug Fixes

* Added lockfile ([856eb3c](https://github.com/keyshade-xyz/keyshade/commit/856eb3c1446752b3312854e3b63b60cff223140c))
* **api:** Only user's default workspace returns isDefault: true ([#647](https://github.com/keyshade-xyz/keyshade/issues/647)) ([870b4dc](https://github.com/keyshade-xyz/keyshade/commit/870b4dc7b68f57fbd09a51099f701a57fb0c998d))
* **cli:** Workspace membership API client payload fixed ([#614](https://github.com/keyshade-xyz/keyshade/issues/614)) ([#648](https://github.com/keyshade-xyz/keyshade/issues/648)) ([e23057b](https://github.com/keyshade-xyz/keyshade/commit/e23057b382f0f0d407a9d457876868b9cc39dda1))
* **platform:** Refactor layout structure to improve Navbar positioning & child component ([#661](https://github.com/keyshade-xyz/keyshade/issues/661)) ([31067f3](https://github.com/keyshade-xyz/keyshade/commit/31067f309914fc8cd4ac2c1b854e4d8039af5494))
* **Platfrom:** Replace manual date calculation with dayjs to improve better calculation ([#668](https://github.com/keyshade-xyz/keyshade/issues/668)) ([990eb86](https://github.com/keyshade-xyz/keyshade/commit/990eb86aa5bdeb911c3907df6ea7b52c510e64ad))

### 🔧 Miscellaneous Chores

* **ci:** Add manual trigger ([cfbf4b9](https://github.com/keyshade-xyz/keyshade/commit/cfbf4b98fe665ba0d9f710d54e7a34243b4e716b))
* **ci:** Add missing LATEST_TAG variable ([a2ea2ed](https://github.com/keyshade-xyz/keyshade/commit/a2ea2edc08583ff6a89fed5bb935d3bf12f91c3c))
* **ci:** Fixed misplaced sentry sourcemaps commands ([fbd6f3b](https://github.com/keyshade-xyz/keyshade/commit/fbd6f3be5924c32c0df49177131acd39a3249076))
* **ci:** Fixed scripts ([374f7ed](https://github.com/keyshade-xyz/keyshade/commit/374f7ed31d85d3481af9ccc2ccdb920eee1d463b))
* **ci:** Update API sentry dist folder ([2bc9afb](https://github.com/keyshade-xyz/keyshade/commit/2bc9afb3e790035e7e3ceec6a568eeab6165be9a))
* **CI:** Update pipeline ([fd63b70](https://github.com/keyshade-xyz/keyshade/commit/fd63b7085f2802b440a9c9628cfe8c0fd609bba9))
* **ci:** Update sourcemap upload commands ([c7e8e45](https://github.com/keyshade-xyz/keyshade/commit/c7e8e45fdcc1b9bad1785618ff43bf3bf5785783))
* **cli:** Bumped CLI version to 2.5.0 ([7b772f8](https://github.com/keyshade-xyz/keyshade/commit/7b772f83cda360eeff9b69f5f2a76458e5bcd406))
* Fix prerelease branch config ([7e84021](https://github.com/keyshade-xyz/keyshade/commit/7e8402140e4cefe021fd9269829d38643aa94404))
* **release:** 2.10.0-stage.1 [skip ci] ([a4f8414](https://github.com/keyshade-xyz/keyshade/commit/a4f8414e8b4e1c1300ee4eadeffe5b3d48a610fe)), closes [#652](https://github.com/keyshade-xyz/keyshade/issues/652)
* **release:** 2.10.0-stage.2 [skip ci] ([00ee123](https://github.com/keyshade-xyz/keyshade/commit/00ee1233552f822493a7b67f716d5300cc48c476)), closes [#647](https://github.com/keyshade-xyz/keyshade/issues/647)
* **release:** 2.10.0-stage.3 [skip ci] ([941a815](https://github.com/keyshade-xyz/keyshade/commit/941a8158827ee9be7e4421468ae2eedfe27aad90)), closes [#655](https://github.com/keyshade-xyz/keyshade/issues/655)
* **release:** 2.10.0-stage.4 [skip ci] ([ae7c44f](https://github.com/keyshade-xyz/keyshade/commit/ae7c44f7746bcc2a743d4edb81f78fb3585c54ac)), closes [#614](https://github.com/keyshade-xyz/keyshade/issues/614) [#648](https://github.com/keyshade-xyz/keyshade/issues/648)
* **release:** 2.10.0-stage.5 [skip ci] ([d718483](https://github.com/keyshade-xyz/keyshade/commit/d7184830804fd6661e5af13c462687a61d7465a5)), closes [#661](https://github.com/keyshade-xyz/keyshade/issues/661)
* **release:** 2.10.0-stage.6 [skip ci] ([4e63f47](https://github.com/keyshade-xyz/keyshade/commit/4e63f47c6426112de00e50a0cfd4e224e9a5e63e)), closes [#668](https://github.com/keyshade-xyz/keyshade/issues/668)
* **release:** 2.10.0-stage.7 [skip ci] ([4a35fe7](https://github.com/keyshade-xyz/keyshade/commit/4a35fe734288f5cbfb3d704edc9e483763bbd722)), closes [#671](https://github.com/keyshade-xyz/keyshade/issues/671)
* **release:** 2.10.0-stage.8 [skip ci] ([36ef21d](https://github.com/keyshade-xyz/keyshade/commit/36ef21d8b6bdabe74ab465355c7455cde0756279)), closes [#670](https://github.com/keyshade-xyz/keyshade/issues/670)
* **release:** 2.9.2-stage.1 [skip ci] ([443f8d4](https://github.com/keyshade-xyz/keyshade/commit/443f8d4c06e2f3306e4e36998c2694eb2dd5f369))

### 🔨 Code Refactoring

* **api:** Update getSelf function ([fe752ce](https://github.com/keyshade-xyz/keyshade/commit/fe752ce1f19582da2c5be9c48b0d7ef1a6332284))

## [2.10.0-stage.8](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.7...v2.10.0-stage.8) (2025-01-28)

### 🚀 Features

* **platform:** Operate on environments ([#670](https://github.com/keyshade-xyz/keyshade/issues/670)) ([f45c5fa](https://github.com/keyshade-xyz/keyshade/commit/f45c5fa81728832f6ff74c5c26d52e00e32fb546))

## [2.10.0-stage.7](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.6...v2.10.0-stage.7) (2025-01-28)

### 🚀 Features

* **platform:** Implement delete project ([#671](https://github.com/keyshade-xyz/keyshade/issues/671)) ([d243c89](https://github.com/keyshade-xyz/keyshade/commit/d243c89be2358f104ad893b5c955d814835aa8e8))

## [2.10.0-stage.6](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.5...v2.10.0-stage.6) (2025-01-26)

### 🐛 Bug Fixes

* **Platfrom:** Replace manual date calculation with dayjs to improve better calculation ([#668](https://github.com/keyshade-xyz/keyshade/issues/668)) ([990eb86](https://github.com/keyshade-xyz/keyshade/commit/990eb86aa5bdeb911c3907df6ea7b52c510e64ad))

### 🔧 Miscellaneous Chores

* **ci:** Update API sentry dist folder ([2bc9afb](https://github.com/keyshade-xyz/keyshade/commit/2bc9afb3e790035e7e3ceec6a568eeab6165be9a))
* **CI:** Update pipeline ([fd63b70](https://github.com/keyshade-xyz/keyshade/commit/fd63b7085f2802b440a9c9628cfe8c0fd609bba9))

## [2.10.0-stage.5](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.4...v2.10.0-stage.5) (2025-01-25)

### 🐛 Bug Fixes

* **platform:** Refactor layout structure to improve Navbar positioning & child component ([#661](https://github.com/keyshade-xyz/keyshade/issues/661)) ([31067f3](https://github.com/keyshade-xyz/keyshade/commit/31067f309914fc8cd4ac2c1b854e4d8039af5494))

## [2.10.0-stage.4](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.3...v2.10.0-stage.4) (2025-01-25)

### 🐛 Bug Fixes

* **cli:** Workspace membership API client payload fixed ([#614](https://github.com/keyshade-xyz/keyshade/issues/614)) ([#648](https://github.com/keyshade-xyz/keyshade/issues/648)) ([e23057b](https://github.com/keyshade-xyz/keyshade/commit/e23057b382f0f0d407a9d457876868b9cc39dda1))

## [2.10.0-stage.3](https://github.com/keyshade-xyz/keyshade/compare/v2.10.0-stage.2...v2.10.0-stage.3) (2025-01-25)

### 🚀 Features
Expand Down
106 changes: 105 additions & 1 deletion apps/api/src/environment/environment.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ 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'
import { SecretService } from '@/secret/service/secret.service'
import { VariableService } from '@/variable/service/variable.service'
import { SecretModule } from '@/secret/secret.module'
import { VariableModule } from '@/variable/variable.module'

describe('Environment Controller Tests', () => {
let app: NestFastifyApplication
Expand All @@ -37,6 +41,8 @@ describe('Environment Controller Tests', () => {
let environmentService: EnvironmentService
let userService: UserService
let eventService: EventService
let secretService: SecretService
let variableService: VariableService

let user1: User, user2: User
let workspace1: Workspace
Expand All @@ -50,7 +56,9 @@ describe('Environment Controller Tests', () => {
EventModule,
ProjectModule,
EnvironmentModule,
UserModule
UserModule,
SecretModule,
VariableModule
]
})
.overrideProvider(MAIL_SERVICE)
Expand All @@ -65,6 +73,8 @@ describe('Environment Controller Tests', () => {
eventService = moduleRef.get(EventService)
environmentService = moduleRef.get(EnvironmentService)
userService = moduleRef.get(UserService)
secretService = moduleRef.get(SecretService)
variableService = moduleRef.get(VariableService)

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

Expand Down Expand Up @@ -465,6 +475,100 @@ describe('Environment Controller Tests', () => {
)
})

it('should be able to get the count of secrets and variables in an environment', async () => {
// Add secrets to the environment
const secret1 = await secretService.createSecret(
user1,
{
name: 'Secret 1',
entries: [
{
value: 'Secret 1 value',
environmentSlug: environment1.slug
}
]
},
project1.slug
)
await secretService.createSecret(
user1,
{
name: 'Secret 2',
entries: [
{
value: 'Secret 2 value',
environmentSlug: environment1.slug
}
]
},
project1.slug
)

// Add variables to the environment
const variable1 = await variableService.createVariable(
user1,
{
name: 'Variable 1',
entries: [
{
value: 'Variable 1 value',
environmentSlug: environment1.slug
}
]
},
project1.slug
)
await variableService.createVariable(
user1,
{
name: 'Variable 2',
entries: [
{
value: 'Variable 2 value',
environmentSlug: environment1.slug
}
]
},
project1.slug
)

// Update the value of a secret to add a SecretVersion
await secretService.updateSecret(user1, secret1.secret.slug, {
entries: [
{
value: 'Updated Secret 1 value',
environmentSlug: environment1.slug
}
]
})

// Update the value of a variable to add a VariableVersion
await variableService.updateVariable(user1, variable1.variable.slug, {
entries: [
{
value: 'Updated Variable 1 value',
environmentSlug: environment1.slug
}
]
})

const response = await app.inject({
method: 'GET',
url: `/environment/all/${project1.slug}?page=0&limit=10`,
headers: {
'x-e2e-user-email': user1.email
}
})

expect(response.statusCode).toBe(200)
const devEnvironment = response
.json()
.items.find((env: Environment) => env.slug === environment1.slug)

expect(devEnvironment.secrets).toBe(2)
expect(devEnvironment.variables).toBe(2)
})

it('should not be able to fetch all environments of a project that does not exist', async () => {
const response = await app.inject({
method: 'GET',
Expand Down
Loading

0 comments on commit 3ab265a

Please sign in to comment.