Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: pipeline upgrade #473

Merged
merged 9 commits into from
Mar 12, 2024
Merged
1 change: 1 addition & 0 deletions docker-compose.env.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DEBUG=1
APPLY_MIGRATIONS=1
CREATE_SUPERUSER=1
SEED_DEVELOPMENT_DATA=0
SET_ALLOWED_DATA_FIELDS=1
terovirtanen marked this conversation as resolved.
Show resolved Hide resolved

OIDC_CLIENT_ID=<ENTER TUNNISTAMO CLIENT ID HERE>
OIDC_CLIENT_SECRET=<ENTER TUNNISTAMO CLIENT SECRET HERE>
Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ if [[ "$APPLY_MIGRATIONS" = "1" ]] && [[ "$SEED_DEVELOPMENT_DATA" = "1" ]]; then
./manage.py seed_development_data
fi

if [[ "$APPLY_MIGRATIONS" = "1" ]] && [[ "$SET_ALLOWED_DATA_FIELDS" = "1" ]]; then
terovirtanen marked this conversation as resolved.
Show resolved Hide resolved
echo "Set allowed data fields..."
./manage.py set_allowed_data_fields < open_city_profile/configuration/allowed_data_fields.json
fi

# Create superuser
if [[ "$CREATE_SUPERUSER" = "1" ]]; then
./manage.py add_admin_user -u admin -p admin -e [email protected]
Expand Down
54 changes: 54 additions & 0 deletions open_city_profile/configuration/allowed_data_fields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[
{
"field_name": "name",
"translations": [
{"code": "en", "label": "Name"},
{"code": "fi", "label": "Nimi"},
{"code": "sv", "label": "Namn"}
]
},
{
"field_name": "personalidentitycode",
"translations": [
{"code": "en", "label": "Personal identity code"},
{"code": "fi", "label": "Henkilötunnus"},
{"code": "sv", "label": "Personbeteckning"}
],
"aliases": ["Personal_identity_code", "ssn"]
},
{
"field_name": "address",
"translations": [
{"code": "en", "label": "Addresses"},
{"code": "fi", "label": "Osoitteet"},
{"code": "sv", "label": "Adresser"}
],
"aliases": ["addresses"]
},
{
"field_name": "municipalityofresidence",
"translations": [
{"code": "en", "label": "Municipality of residence"},
{"code": "fi", "label": "Kotikunta"},
{"code": "sv", "label": "Hemkommun"}
],
"aliases": ["homemunicipality", "Municipality_of_residence"]
},
{
"field_name": "phone",
"translations": [
{"code": "en", "label": "Phone numbers"},
{"code": "fi", "label": "Puhelinnumerot"},
{"code": "sv", "label": "Telefonnummer"}
],
"aliases": ["phones"]
},
{
"field_name": "email",
"translations": [
{"code": "en", "label": "Emails"},
{"code": "fi", "label": "Sähköpostiosoitteet"},
{"code": "sv", "label": "E-postadresser"}
]
}
]
52 changes: 52 additions & 0 deletions pipelines/helsinki-profile-api-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Continuous integration (CI) triggers cause a pipeline to run whenever you push
# an update to the specified branches or you push specified tags.
trigger:
batch: true
branches:
include:
- main
paths:
exclude:
- '*release-please*'
- '*.md'
- '.github/'
- 'pipelines/helsinki-profile-api-release.yml'
- 'pipelines/helsinki-profile-api-review.yml'
- 'docker-compose*'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
# such a pull request.
#
# GitHub creates a new ref when a pull request is created. The ref points to a
# merge commit, which is the merged code between the source and target branches
# of the pull request.
#
# Opt out of pull request validation
pr: none

# By default, use self-hosted agents
pool: Default

resources:
repositories:
# Azure DevOps repository
- repository: helsinki-profile-api
type: git
# Azure DevOps project/repository
name: helsinki-profile-api-ops/helsinki-profile-api

extends:
# Filename in Azure DevOps Repository
template: azure-pipelines-helsinki-profile-api-dev.yml@helsinki-profile-api
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in helsinki-profile-api
# Default value to pythonVersion is set on template.
# The values here will override the values defined in the helsinki-profile-api repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
## Used tool version
# pythonVersion: 3.11
49 changes: 49 additions & 0 deletions pipelines/helsinki-profile-api-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Continuous integration (CI) triggers cause a pipeline to run whenever you push
# an update to the specified branches or you push specified tags.
trigger:
batch: true
tags:
include:
- open-city-profile-v*

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
# such a pull request.
#
# GitHub creates a new ref when a pull request is created. The ref points to a
# merge commit, which is the merged code between the source and target branches
# of the pull request.
#
# Opt out of pull request validation
pr: none

# By default, use self-hosted agents
pool: Default

resources:
repositories:
# Azure DevOps repository
- repository: helsinki-profile-api
type: git
# Azure DevOps project/repository
name: helsinki-profile-api-ops/helsinki-profile-api

extends:
# Filename in Azure DevOps Repository
template: azure-pipelines-helsinki-profile-api-release.yml@helsinki-profile-api
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in helsinki-profile-api
# Default value to pythonVersion is set on template.
# The values here will override the values defined in the helsinki-profile-api repository
## Staging definitions
# buildArgsStage:
# DEBUG: 1
# configMapStage: # pod environment variables
# DEBUG: 1
## Production definitions
## Production is using staging image
# configMap: # pod environment variables
# DEBUG: 1
## Used tool version
# pythonVersion: 3.11
59 changes: 59 additions & 0 deletions pipelines/helsinki-profile-api-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# Review pipeline. Run build and deploy for Platta dev environments.
# Pipeline runs different tests e.g. unittest and browser tests.
#
# Continuous integration (CI) triggers cause a pipeline to run whenever you push
# an update to the specified branches or you push specified tags.
# only PR trigger pipeline
trigger: none

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
# such a pull request.
#
# GitHub creates a new ref when a pull request is created. The ref points to a
# merge commit, which is the merged code between the source and target branches
# of the pull request.
#
# Opt out of pull request validation
pr:
# PR target branch
branches:
include:
- main
paths:
exclude:
- '*release-please*'
- '*.md'
- '.github/'
- 'pipelines/helsinki-profile-api-release.yml'
- 'pipelines/helsinki-profile-api-dev.yml'
- 'docker-compose*'

# By default, use self-hosted agents
pool: Default

resources:
repositories:
# Azure DevOps repository
- repository: helsinki-profile-api
type: git
ref: refs/heads/ansible_automation_update
# Azure DevOps project/repository
name: helsinki-profile-api-ops/helsinki-profile-api

extends:
# Filename in Azure DevOps Repository
template: azure-pipelines-helsinki-profile-api-review.yml@helsinki-profile-api
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in helsinki-profile-api
# Default value to pythonVersion is set on template.
# The values here will override the values defined in the helsinki-profile-api repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
## Used tool version
# pythonVersion: 3.11