Skip to content

Commit

Permalink
[NOD-541] fix: Updated variable retrieving
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-deri committed Oct 26, 2023
1 parent bb8eb64 commit 2c5eca3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/04_release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
name: Create a New Release
runs-on: ubuntu-latest
needs: [setup]
environment: ${{ inputs.environment }}
outputs:
version: ${{ steps.release.outputs.version }}
registry_image: ${{ steps.get_image.outputs.registry_image }}
Expand Down Expand Up @@ -112,8 +113,6 @@ jobs:
with:
environment: ${{ matrix.environment }}
target: ${{ needs.setup.outputs.environment }}
resource_group: ${{ vars.FUNCTION_RESOURCE_GROUP }}
app_name: ${{ vars.FUNCTION_APP_NAME }}
registry_image: ${{ needs.release.outputs.registry_image }}

notify:
Expand Down
32 changes: 11 additions & 21 deletions .github/workflows/04_self_hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ on:
required: true
description: The environment target of the job
type: string
resource_group:
required: true
description: The resource group of the function to deploy
type: string
app_name:
required: true
description: The name of the function to deploy
type: string
registry_image:
required: true
description: The name of the image from container registry to be used
Expand All @@ -32,13 +24,14 @@ jobs:
show_input:
runs-on: ubuntu-latest
if: ${{ inputs.target == inputs.environment }}
environment: ${{ inputs.environment }}
steps:
- name: Get input parameters
run: |
echo environment=${{ inputs.environment }}
echo target=${{ inputs.target }}
echo resource_group=${{ inputs.resource_group }}
echo app_name=${{ inputs.app_name }}
echo resource_group=${{ vars.FUNCTION_RESOURCE_GROUP }}
echo app_name=${{ vars.FUNCTION_APP_NAME }}
echo registry_image=${{ inputs.registry_image }}
Expand All @@ -47,8 +40,7 @@ jobs:
name: Create staging slots
runs-on: ubuntu-22.04
if: ${{ inputs.target == inputs.environment && inputs.target == 'prod' }}
environment:
name: ${{ inputs.environment }}
environment: ${{ inputs.environment }}
steps:
- name: Create staging slots
uses: pagopa/github-actions-template/azure-function-start-staging-slot@a1b72480e9ac555364be0b7ecdcc8f5ab1c89ad9
Expand All @@ -57,8 +49,8 @@ jobs:
client_id: ${{ secrets.CLIENT_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
resource_group: ${{ inputs.resource_group }}
app_name: ${{ inputs.app_name }}
resource_group: ${{ vars.FUNCTION_RESOURCE_GROUP }}
app_name: ${{ vars.FUNCTION_APP_NAME }}
registry_image: ${{ inputs.registry_image }}


Expand All @@ -68,8 +60,7 @@ jobs:
runs-on: ubuntu-22.04
needs: [ start_staging_slot ]
if: ${{ always() && inputs.target == inputs.environment }}
environment:
name: ${{ inputs.environment }}
environment: ${{ inputs.environment }}
steps:
- name: Deploy Azure Function
uses: pagopa/github-actions-template/azure-functions-deploy@a1b72480e9ac555364be0b7ecdcc8f5ab1c89ad9
Expand All @@ -78,7 +69,7 @@ jobs:
client_id: ${{ secrets.CLIENT_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
app_name: ${{ inputs.app_name }}
app_name: ${{ vars.FUNCTION_APP_NAME }}
registry_image: ${{ inputs.registry_image }}


Expand All @@ -88,8 +79,7 @@ jobs:
needs: [ start_staging_slot, deploy ]
if: ${{ success() || failure() && (inputs.target == inputs.environment && inputs.target == 'prod') }}
runs-on: ubuntu-22.04
environment:
name: ${{ inputs.environment }}
environment: ${{ inputs.environment }}
steps:
- name: Deploy Azure Function
uses: pagopa/github-actions-template/azure-function-stop-staging-slot@a1b72480e9ac555364be0b7ecdcc8f5ab1c89ad9
Expand All @@ -98,6 +88,6 @@ jobs:
client_id: ${{ secrets.CLIENT_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
resource_group: ${{ inputs.resource_group }}
app_name: ${{ inputs.app_name }}
resource_group: ${{ vars.FUNCTION_RESOURCE_GROUP }}
app_name: ${{ vars.FUNCTION_APP_NAME }}
registry_image: ${{ inputs.registry_image }}
2 changes: 1 addition & 1 deletion .identity/00_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ data "azurerm_key_vault_secret" "key_vault_slack_webhook_url" {
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
}

data "azurerm_resource_group" "nodo_re_rg" {
data "azurerm_resource_group" "nodo_verifyko_rg" {
name = "pagopa-${var.env_short}-${local.location_short}-nodo-verifyko-to-datastore-rg"
}
2 changes: 1 addition & 1 deletion .identity/02_application_action.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource "null_resource" "github_runner_app_permissions_to_namespace" {
}

resource "azurerm_role_assignment" "environment_function" {
scope = data.azurerm_resource_group.nodo_re_rg.id
scope = data.azurerm_resource_group.nodo_verifyko_rg.id
role_definition_name = "Contributor"
principal_id = module.github_runner_app.object_id
}
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG JAVA_VERSION=11
# This image additionally contains function core tools – useful when using custom extensions
FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION-build AS installer-env

COPY . /src/java-function-app
RUN cd /src/java-function-app && \
mkdir -p /home/site/wwwroot && \
mvn clean package -Dmaven.test.skip=true && \
cd ./target/azure-functions/ && \
cd $(ls -d */|head -n 1) && \
cp -a . /home/site/wwwroot

# This image is ssh enabled
#FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION-appservice
# This image isn't ssh enabled
FROM mcr.microsoft.com/azure-functions/java:3.0-java$JAVA_VERSION

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true

EXPOSE 80
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

0 comments on commit 2c5eca3

Please sign in to comment.