adding test environment
This commit is contained in:
@@ -2,7 +2,7 @@ name: 'API Build and Deploy'
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
calling_workflow:
|
environment_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
version_number:
|
version_number:
|
||||||
@@ -12,7 +12,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: ${{ inputs.calling_workflow }}
|
environment: ${{ inputs.environment_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -44,36 +44,26 @@ jobs:
|
|||||||
pnpm --filter api build
|
pnpm --filter api build
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
run: |
|
run: |
|
||||||
pnpm --filter api --prod deploy ./.prod/api
|
pnpm --filter api --prod deploy ./.prod/api
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
- name: Log into Docker Hub
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build and push to registry
|
- name: Build and push to registry
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: noahspan/flying-api:${{ inputs.version_number }}
|
tags: noahspan/flying-api:${{ inputs.version_number }}
|
||||||
context: .
|
context: .
|
||||||
target: api
|
target: api
|
||||||
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: ${{ inputs.calling_workflow }}
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Log in to Azure
|
|
||||||
uses: azure/login@v2
|
|
||||||
with:
|
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
|
||||||
|
|
||||||
- name: Update Container App
|
|
||||||
run: |
|
|
||||||
az containerapp update --name flying-api-${{ inputs.calling_workflow }} --revision-suffix ${{ inputs.version_number }} --resource-group noahspan --image docker.io/noahspan/flying-api:${{ inputs.version_number }}
|
|
||||||
@@ -44,36 +44,26 @@ jobs:
|
|||||||
pnpm --filter app build
|
pnpm --filter app build
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
run: |
|
run: |
|
||||||
pnpm --filter app --prod deploy ./.prod/app
|
pnpm --filter app --prod deploy ./.prod/app
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
- name: Log into Docker Hub
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push to registry
|
- name: Build and push to registry
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: noahspan/flying-app:${{ inputs.version_number }}
|
tags: noahspan/flying-app:${{ inputs.version_number }}
|
||||||
context: .
|
context: .
|
||||||
target: app
|
target: app
|
||||||
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: ${{ inputs.calling_workflow }}
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Log in to Azure
|
|
||||||
uses: azure/login@v2
|
|
||||||
with:
|
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
|
||||||
|
|
||||||
- name: Update Container App
|
|
||||||
run: |
|
|
||||||
az containerapp update --name flying-app-${{ inputs.calling_workflow }} --revision-suffix ${{ inputs.version_number }} --resource-group noahspan --image docker.io/noahspan/flying-app:${{ inputs.version_number }}
|
|
||||||
27
.github/workflows/deploy.yaml
vendored
Normal file
27
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Deploy
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
app_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
environment_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
version_number:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: ${{ inputs.environment_name }}
|
||||||
|
steps:
|
||||||
|
- name: Log in to Azure
|
||||||
|
uses: azure/login@v2
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
|
||||||
|
- name: Update Container App
|
||||||
|
run: |
|
||||||
|
az containerapp update --name ${{ inputs.app_name }}}}-${{ inputs.environment_name }} --revision-suffix ${{ inputs.version_number }} --resource-group noahspan --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
||||||
42
.github/workflows/main.yaml
vendored
Normal file
42
.github/workflows/main.yaml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Main
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-api:
|
||||||
|
name: build-api
|
||||||
|
uses: ./.github/workflows/api_build.yaml
|
||||||
|
with:
|
||||||
|
environment_name: test
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
deploy-api:
|
||||||
|
name: deploy-api
|
||||||
|
needs: build-api
|
||||||
|
uses: ./.github/workflows/deploy.yaml
|
||||||
|
with:
|
||||||
|
app_name: flying-app
|
||||||
|
environment_name: test
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
build-app:
|
||||||
|
name: build-app
|
||||||
|
uses: ./.github/workflows/app_build.yaml
|
||||||
|
with:
|
||||||
|
environment_name: test
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
deploy-app:
|
||||||
|
name: deploy-app
|
||||||
|
needs: build-app
|
||||||
|
uses: ./.github/workflows/deploy.yaml
|
||||||
|
with:
|
||||||
|
app_name: flying-app
|
||||||
|
environment_name: test
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
21
.github/workflows/pull_request.yaml
vendored
21
.github/workflows/pull_request.yaml
vendored
@@ -2,25 +2,20 @@ name: Pull Request
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened, closed]
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-deploy-api:
|
build-api:
|
||||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
name: build-api
|
||||||
name: build-deploy-api
|
uses: ./.github/workflows/api_build.yaml
|
||||||
uses: ./.github/workflows/api.yaml
|
|
||||||
with:
|
with:
|
||||||
calling_workflow: pull_request
|
environment_name: pull_request
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
build-deploy-app:
|
build-app:
|
||||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
name: build-app
|
||||||
name: build-deploy-app
|
uses: ./.github/workflows/app_build.yaml
|
||||||
uses: ./.github/workflows/app.yaml
|
|
||||||
with:
|
with:
|
||||||
calling_workflow: pull_request
|
environment_name: pull_request
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
42
.github/workflows/tag.yaml
vendored
Normal file
42
.github/workflows/tag.yaml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Tag
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-api:
|
||||||
|
name: build-api
|
||||||
|
uses: ./.github/workflows/api_build.yaml
|
||||||
|
with:
|
||||||
|
environment_name: prod
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
deploy-api:
|
||||||
|
name: deploy-api
|
||||||
|
needs: build-api
|
||||||
|
uses: ./.github/workflows/deploy.yaml
|
||||||
|
with:
|
||||||
|
app_name: flying-api
|
||||||
|
environment_name: prod
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
build-app:
|
||||||
|
name: build-app
|
||||||
|
uses: ./.github/workflows/app_build.yaml
|
||||||
|
with:
|
||||||
|
environment_name: prod
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
deploy-app:
|
||||||
|
name: deploy-app
|
||||||
|
needs: build-app
|
||||||
|
uses: ./.github/workflows/deploy.yaml
|
||||||
|
with:
|
||||||
|
app_name: flying-app
|
||||||
|
environment_name: prod
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
data "azurerm_app_configuration" "app_configuration" {
|
|
||||||
name = "noahspan-appconfig"
|
|
||||||
resource_group_name = data.azurerm_resource_group.resource_group.name
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_app_configuration_feature" "pilots_app_configuration_feature" {
|
|
||||||
configuration_store_id = data.azurerm_app_configuration.app_configuration.id
|
|
||||||
description = "Feature flag for pilots page"
|
|
||||||
name = "flying-pilots"
|
|
||||||
label = var.WORKSPACE
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_app_configuration_feature" "logbook_app_configuration_feature" {
|
|
||||||
configuration_store_id = data.azurerm_app_configuration.app_configuration.id
|
|
||||||
description = "Feature flag for logbook page"
|
|
||||||
name = "flying-logbook"
|
|
||||||
label = var.WORKSPACE
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
@@ -1,76 +1,60 @@
|
|||||||
locals {
|
locals {
|
||||||
container_app_app_name = {
|
container_app_app_name = {
|
||||||
dev = "flying-app-dev"
|
|
||||||
test = "flying-app-test"
|
test = "flying-app-test"
|
||||||
prod = "flying-app-prod"
|
prod = "flying-app-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_app_container_image = {
|
container_app_app_container_image = {
|
||||||
dev = "noahspan/flying-app:v0.0.1"
|
|
||||||
test = "noahspan/flying-app:v0.0.1"
|
test = "noahspan/flying-app:v0.0.1"
|
||||||
prod = "noahspan/flying-app:v0.0.1"
|
prod = "noahspan/flying-app:v0.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_app_container_name = {
|
container_app_app_container_name = {
|
||||||
dev = "flying-app-dev"
|
|
||||||
test = "flying-app-test"
|
test = "flying-app-test"
|
||||||
prod = "flying-app-prod"
|
prod = "flying-app-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_app_redirect_url = {
|
|
||||||
dev = "https://flying-app-dev.greensea-e83e7646.centralus.azurecontainerapps.io"
|
|
||||||
}
|
|
||||||
|
|
||||||
container_app_api_name = {
|
container_app_api_name = {
|
||||||
dev = "flying-api-dev"
|
|
||||||
test = "flying-api-test"
|
test = "flying-api-test"
|
||||||
prod = "flying-api-prod"
|
prod = "flying-api-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_api_container_image = {
|
container_app_api_container_image = {
|
||||||
dev = "noahspan/flying-api:v0.0.1"
|
|
||||||
test = "noahspan/flying-api:v0.0.1"
|
test = "noahspan/flying-api:v0.0.1"
|
||||||
prod = "noahspan/flying-api:v0.0.1"
|
prod = "noahspan/flying-api:v0.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_api_container_name = {
|
container_app_api_container_name = {
|
||||||
dev = "flying-api-dev"
|
|
||||||
test = "flying-api-test"
|
test = "flying-api-test"
|
||||||
prod = "flying-api-prod"
|
prod = "flying-api-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_api_dapr_app_id = {
|
container_app_api_dapr_app_id = {
|
||||||
dev = "flyingapidev"
|
|
||||||
test = "flyingapitest"
|
test = "flyingapitest"
|
||||||
prod = "flyingpapiprod"
|
prod = "flyingpapiprod"
|
||||||
}
|
}
|
||||||
|
|
||||||
container_app_environment_name = {
|
container_app_environment_name = {
|
||||||
dev = "flying-dev"
|
|
||||||
test = "flying-test"
|
test = "flying-test"
|
||||||
prod = "flying-prod"
|
prod = "flying-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
logbook_feature_flag_active = {
|
logbook_feature_flag_active = {
|
||||||
dev = "true"
|
|
||||||
test = "true"
|
test = "true"
|
||||||
prod = "true"
|
prod = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_analytics_workspace_name = {
|
log_analytics_workspace_name = {
|
||||||
dev = "flying-log-analytics-workspace-dev"
|
|
||||||
test = "flying-log-analytics-workspace-test"
|
test = "flying-log-analytics-workspace-test"
|
||||||
prod = "flying-log-analytics-workspace-prod"
|
prod = "flying-log-analytics-workspace-prod"
|
||||||
}
|
}
|
||||||
|
|
||||||
pilots_feature_flag_active = {
|
pilots_feature_flag_active = {
|
||||||
dev = "true"
|
|
||||||
test = "true"
|
test = "true"
|
||||||
prod = "true"
|
prod = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
storage_account_name = {
|
storage_account_name = {
|
||||||
dev = "noahspanflyingdev"
|
|
||||||
test = "noahspanflyingtest"
|
test = "noahspanflyingtest"
|
||||||
prod = "noahspanflyingprod"
|
prod = "noahspanflyingprod"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ output "container_app_api_name" {
|
|||||||
value = local.container_app_api_name[var.environment]
|
value = local.container_app_api_name[var.environment]
|
||||||
}
|
}
|
||||||
|
|
||||||
output "container_app_app_redirect_url" {
|
|
||||||
value = local.container_app_app_redirect_url[var.environment]
|
|
||||||
}
|
|
||||||
|
|
||||||
output "container_app_api_container_image" {
|
output "container_app_api_container_image" {
|
||||||
value = local.container_app_api_container_image[var.environment]
|
value = local.container_app_api_container_image[var.environment]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# output "api_key" {
|
|
||||||
# value = azurerm_static_web_app.static_web_app.api_key
|
|
||||||
# sensitive = true
|
|
||||||
# }
|
|
||||||
|
|
||||||
# output "default_host_name" {
|
|
||||||
# value = azurerm_static_web_app.static_web_app.default_host_name
|
|
||||||
# }
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
provider "azurerm" {
|
provider "azurerm" {
|
||||||
features {
|
features {}
|
||||||
key_vault {
|
|
||||||
purge_soft_deleted_certificates_on_destroy = true
|
|
||||||
recover_soft_deleted_secrets = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,10 +6,6 @@ variable "APP_SUBDOMAIN_NAME" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "AZURE_STORAGE_CONNECTION_STRING" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "CLIENT_ID" {
|
variable "CLIENT_ID" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
@@ -32,10 +28,6 @@ variable "DOMAIN_NAME" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "CUSTOM_DOMAIN_NAME_COUNT" {
|
|
||||||
type = number
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "REGION" {
|
variable "REGION" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user