Skip to content

Commit

Permalink
Merge pull request #36 from istat-methodology/GM-working
Browse files Browse the repository at this point in the history
Merge Development with Production
  • Loading branch information
giulio-massacci authored May 6, 2024
2 parents b617d75 + 01d669a commit 6a7b6e1
Show file tree
Hide file tree
Showing 55 changed files with 4,693 additions and 3,869 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/powershell:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-vscode.powershell"
]
}
}
}
54 changes: 49 additions & 5 deletions .github/workflows/main_istat-terra-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ name: Terra Python CI/CD

on:
workflow_dispatch:


permissions:
id-token: write
contents: read

jobs:
build:
runs-on: 'ubuntu-latest'
Expand All @@ -27,13 +31,31 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: istatcosmo.azurecr.io/cosmo-python-service:run-${{ github.run_number }},istatcosmo.azurecr.io/cosmo-python-service:latest
tags: istatcosmo.azurecr.io/cosmo-python-service:2.0.${{ github.run_number }},istatcosmo.azurecr.io/cosmo-python-service:latest
context: ./terra-backend/python-server/
build-args: "DOCKER_TAG=run-${{ github.run_number }}"
build-args: "DOCKER_TAG=2.0.${{ github.run_number }}"

deploy:
deploy-dev:
runs-on: ubuntu-latest
needs: build
environment:
name: 'development'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'istat-cosmo-python'
slot-name: 'dev'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_PYTHONSERVICE }}
images: 'istatcosmo.azurecr.io/cosmo-python-service:2.0.${{ github.run_number }}'

deploy:
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
needs: [build, deploy-dev]
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
Expand All @@ -46,4 +68,26 @@ jobs:
app-name: 'istat-cosmo-python'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_PYTHONSERVICE }}
images: 'istatcosmo.azurecr.io/cosmo-python-service:run-${{ github.run_number }}'
images: 'istatcosmo.azurecr.io/cosmo-python-service:2.0.${{ github.run_number }}'

#deployaca:
# runs-on: ubuntu-latest
# needs: build
# environment:
# name: 'development-aca'
#
# steps:
# - name: Azure Login
# uses: Azure/[email protected]
# with:
# client-id: ${{ secrets.AZ_CLIENT_ID }}
# tenant-id: ${{ secrets.AZ_TENANT_ID }}
# subscription-id: ${{ secrets.AZ_SUBSCRIPTION_ID }}
#
# - name: Deploy Container App
# shell: pwsh
# env:
# CONTAINERAPP_NAME: ${{ vars.PYTHON_CONTAINERAPP_NAME }}
# CONTAINERAPP_RG: ${{ vars.TERRA_RG }}
# run: |
# az containerapp update --image 'istatcosmo.azurecr.io/cosmo-python-service:run-${{ github.run_number }}' -n $env:CONTAINERAPP_NAME -g $env:CONTAINERAPP_RG
10 changes: 3 additions & 7 deletions .github/workflows/publish-batch-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
branches: [ main ]
paths:
- terra-update-batch/**
pull_request:
branches: [ main ]
paths:
- terra-update-batch/**

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -47,14 +43,14 @@ jobs:
run: |
pushd terra-update-batch
Get-Content cosmoDataUpdate.py | ?{ $_ -match '^# Version ([0-9]+)\.([0-9]+)\.([0-9\.]*)$' }
Get-Content main.py | ?{ $_ -match '^# Version ([0-9]+)\.([0-9]+)\.([0-9\.]*)$' }
if ($Env:USE_RUN_NUMBER_AS_VERSION -eq "1") {
$Version = "$($matches[1]).$($matches[2]).${{ github.run_number }}"
} else {
$Version = "$($matches[1]).$($matches[2]).$($matches[3])"
}
$Pkg = "cosmoDataUpdate_$Version.zip"
Compress-Archive -Update -Path cosmoDataUpdate.py, cosmoUtility.py, run.sh, requirements.txt -DestinationPath $Pkg
$Pkg = "terraDataUpdate_$Version.zip"
Compress-Archive -Update -Path *.py, modules, resources, execute, run.sh, requirements.txt -DestinationPath $Pkg
dir $Pkg | ft Name,Length,LastWriteTime
az batch application package create `
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terra-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
deployment_environment: "development"

build_and_deploy_job_production:
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
needs: build_and_deploy_job_development
name: Build and Deploy Job - Production
Expand Down
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,168 @@
terra-frontend/node_modules/
terra-backend/json-server/node_modules/
terra-backend/json-server/data/
terra-backend/R-server/data/
terra-backend/python-server/data/
terra-update-batch/cosmoDataUpdate-*.zip
terra-backend/R-server/.Rhistory

# Byte-compiled / optimized / DLL files
__pycache__
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
#.env
#.venv
#env/
#venv/
#ENV/
#env.bak/
#venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Loading

0 comments on commit 6a7b6e1

Please sign in to comment.