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

[IOPAY-402] update node 14 & fp-ts #320

Merged
merged 39 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
80ad603
[IOPAY-402] update node version and necessary dependency
infantesimone Dec 21, 2021
08d50b8
[IOPAY-402] update to eslint
infantesimone Dec 22, 2021
cbaa0e3
lint app.ts
infantesimone Dec 22, 2021
3350575
lint & fix configuration.ts
infantesimone Dec 22, 2021
ada2eec
Update imports and fix old `fp-ts` usages
giovanniberti Dec 22, 2021
2fde682
Update imports and refactor code using `fp-ts`
giovanniberti Dec 22, 2021
78950bc
[IOPAY-402] update fp-ts & linting
infantesimone Dec 22, 2021
c3462e4
Finish fixing source tree `fp-ts` usages
giovanniberti Dec 23, 2021
bd7445a
[IOPAY--402] fix payment converter
infantesimone Dec 23, 2021
f6d9c8a
Update `fp-ts` usages in `MockedData.ts`
giovanniberti Dec 23, 2021
7ff3ca3
[IOPAY-402] fix fake data for integration tests
infantesimone Dec 23, 2021
7020ed1
Update `fp-ts` usages in `PaymentController.test.ts`
giovanniberti Dec 23, 2021
d7cae9f
[IOPAY-402] new pagopa.ts custom
infantesimone Dec 23, 2021
cdbc9bd
[IOPAY-402] fix integrations tests
infantesimone Dec 23, 2021
7504ed7
Update comment regarding type conversion inside `PaymentsConverter.ts`
giovanniberti Dec 23, 2021
5255244
Update `node` version inside Docker images
giovanniberti Dec 23, 2021
7d83ff9
Fix wrong app source path in Dockerfile for eslint config
giovanniberti Dec 23, 2021
674aa38
Fix parameter name in `/payment-requests` controller route
giovanniberti Dec 23, 2021
fa5bc0d
Update node version in code review pipeline
giovanniberti Dec 31, 2021
7eb685f
Add test stage in deploy pipeline
giovanniberti Dec 31, 2021
5923023
Add yaml pipelines under pagopa subscription
giovanniberti Jan 3, 2022
40ac0f8
[IOPAY-402] rename api tests folder
infantesimone Jan 3, 2022
b4421d6
[IOPAY-402] delete old pipelines
infantesimone Jan 3, 2022
5660591
disable detectOpenHandles
infantesimone Jan 3, 2022
7be7c0b
enable pipeline only for dev env
infantesimone Jan 3, 2022
ee52e47
[IOPAY-402] fix endpoint for pagopaCommons yml templates
infantesimone Jan 3, 2022
d7a487c
[IOPAY-402] fix deploy pipeline
infantesimone Jan 3, 2022
f7d9655
fix resourceGroupName in deploy pipeline
infantesimone Jan 4, 2022
bf0bba3
Fix tests working directory
giovanniberti Jan 4, 2022
5036605
Fix redis client config for non-cluster connection
giovanniberti Jan 5, 2022
0a7f486
Refactor API test script to accept arbitrary env files
giovanniberti Jan 5, 2022
33e5e0d
Enable TLS on redis single instance only when redis password is supplied
giovanniberti Jan 7, 2022
4584671
Fix wrong return value in cdInfoWisp service `setActivationStatus` fu…
giovanniberti Jan 10, 2022
7f7fed5
[IOPAY-402] Separate ws endpoint for nodoPerPsp, nodeForPsp and nodeF…
infantesimone Jan 11, 2022
49ff741
fix dispalyName in Deploy_DEV_pagoPA stage
infantesimone Jan 11, 2022
9db7035
Add postman environment to test deployed proxy API
giovanniberti Jan 5, 2022
eacbf0a
update deploy pipeline in order to UAT deploy
infantesimone Jan 12, 2022
bf487e0
fix dependensOn for uat deploy pipeline
infantesimone Jan 12, 2022
cfd95ce
[IOPAY-402] Add check branch in release stage
infantesimone Jan 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#

variables:
NODE_VERSION: '8.9.4'
NODE_VERSION: '14.16.0'
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn

# Automatically triggered on PR
Expand Down
105 changes: 66 additions & 39 deletions .devops/deploy-pipelines.yml → .devops/pagopa-deploy-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@ parameters:
- minor
- patch
default: minor
- name: ENV
displayName: Target Environment
type: string
default: test
values:
- test
- prod

variables:
NODE_VERSION: '8.9.4'
NODE_VERSION: '14.16.0'
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
ENV: ${{ parameters.ENV }}

# Only manual activations are intended
trigger: none
Expand All @@ -39,8 +31,8 @@ resources:
- repository: pagopaCommons
type: github
name: pagopa/azure-pipeline-templates
ref: refs/tags/v4
endpoint: 'pagopa'
ref: refs/tags/v18
endpoint: 'io-azure-devops-github-ro'

stages:

Expand All @@ -49,17 +41,17 @@ stages:
# - is on branch master
# - is a tag in the form v{version}-RELEASE
- stage: Release
#condition:
# and(
# succeeded(),
# or(
# eq(variables['Build.SourceBranch'], 'refs/heads/master'),
# and(
# startsWith(variables['Build.SourceBranch'], 'refs/tags'),
# endsWith(variables['Build.SourceBranch'], '-RELEASE')
# )
# )
# )
condition:
and(
succeeded(),
or(
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
and(
startsWith(variables['Build.SourceBranch'], 'refs/tags'),
endsWith(variables['Build.SourceBranch'], '-RELEASE')
)
)
)
pool:
vmImage: 'ubuntu-latest'
jobs:
Expand Down Expand Up @@ -134,7 +126,7 @@ stages:
- publish: $(System.DefaultWorkingDirectory)/bundle
artifact: Bundle

- stage: Deploy_test
- stage: Deploy_DEV_pagoPA
dependsOn:
- Prepare_artifact
jobs:
Expand All @@ -147,22 +139,57 @@ stages:

- task: AzureWebApp@1
inputs:
azureSubscription: '$(PRODUCTION_AZURE_SUBSCRIPTION)'
resourceGroupName: '$(PRODUCTION_RESOURCE_GROUP_NAME)'
azureSubscription: '$(DEV_AZURE_SUBSCRIPTION)'
resourceGroupName: 'pagopa-d-pagopa-proxy-rg'
appType: 'webApp'
appName: '$(PRODUCTION_PROXYTEST_APP_NAME)'
appName: 'pagopa-d-app-pagopa-proxy'
package: '$(Pipeline.Workspace)/Bundle'
deploymentMethod: 'auto'
displayName: Deploy to production slot
- stage: Deploy_production
displayName: Deploy to DEV-pagoPA

- stage: API_Tests_DEV_pagoPA
dependsOn:
- Prepare_artifact
condition:
and(
succeeded(),
eq(variables['ENV'], 'prod')
)
- Deploy_DEV_pagoPA
jobs:
- job: 'TestAPI'
steps:
- checkout: none

- download: current
artifact: Bundle

- job: integrationTests
steps:
- script: |
yarn global add newman
displayName: 'newman installation'

- task: Bash@3
inputs:
targetType: filePath
filePath: api-tests/ws.sh
arguments: postman ./ENV_DEPLOY.postman_environment.json
workingDirectory: api-tests
failOnStdErr: true
displayName: Run API tests

- stage: DEV_to_UAT_promotion
dependsOn:
- Deploy_DEV_pagoPA
jobs:
- job: Deploy_UAT_WaitForApproval
displayName: Wait for UAT approval
pool: server
timeoutInMinutes: 4320 # 3 days
steps:
- task: ManualValidation@0
timeoutInMinutes: 4320 # 3 days
inputs:
onTimeout: 'skip'

- stage: Deploy_UAT_pagoPA
dependsOn:
- DEV_to_UAT_promotion
jobs:
- job: 'deploy'
steps:
Expand All @@ -173,10 +200,10 @@ stages:

- task: AzureWebApp@1
inputs:
azureSubscription: '$(PRODUCTION_AZURE_SUBSCRIPTION)'
resourceGroupName: '$(PRODUCTION_RESOURCE_GROUP_NAME)'
azureSubscription: '$(UAT_AZURE_SUBSCRIPTION)'
resourceGroupName: 'pagopa-u-pagopa-proxy-rg'
appType: 'webApp'
appName: '$(PRODUCTION_PROXYPROD_APP_NAME)'
appName: 'pagopa-u-app-pagopa-proxy'
package: '$(Pipeline.Workspace)/Bundle'
deploymentMethod: 'auto'
displayName: Deploy to production slot
displayName: Deploy to UAT-pagoPA
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
"env": {
"es6": true,
"node": true
},
"ignorePatterns": [
"node_modules",
"generated",
"**/__tests__/*",
"**/__mocks__/*",
"*.d.ts",
"*.js",
"Dangerfile.ts",
"**/__integration__/*"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"extends": [
"@pagopa/eslint-config/strong",
],
"rules": {}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ generated
.env
.DS_Store
k6example/libs
.eslintcache
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.4
14.16.0
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM circleci/node:8.9.4 as builder
FROM circleci/node:14.16.0 as builder

RUN sudo apt-get -y install --no-install-recommends libunwind8=1.1-3.2
RUN sudo apt-get -y install --no-install-recommends libunwind8=1.1-4.1

WORKDIR /usr/src/app

Expand All @@ -10,12 +10,13 @@ COPY /package.json /usr/src/app/package.json
COPY /tsconfig.json /usr/src/app/tsconfig.json
COPY /yarn.lock /usr/src/app/yarn.lock
COPY /api_pagopa.yaml /usr/src/app/api_pagopa.yaml
COPY /.eslintrc.js /usr/src/app/.eslintrc.js

RUN sudo chmod -R 777 /usr/src/app \
&& yarn install \
&& yarn build

FROM node:8.9.4-alpine
FROM node:14.16.0-alpine
LABEL maintainer="https://teamdigitale.governo.it"

# Install major CA certificates to cover
Expand Down
39 changes: 39 additions & 0 deletions api-tests/ENV_DEPLOY.postman_environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "2d5fedca-6a21-40ce-a7e1-362cc2b8a169",
"name": "ENV_DEPLOY",
"values": [
{
"key": "base_url",
"value": "https://api.dev.platform.pagopa.it/api/checkout/activations/v1",
"enabled": true
},
{
"key": "id_dominio",
"value": "77777777777",
"enabled": true
},
{
"key": "rptid",
"value": "302000100000001425",
"enabled": true
},
{
"key": "rptid_prefix",
"value": "30200",
"enabled": true
},
{
"key": "importo_versamento",
"value": 12000,
"enabled": true
},
{
"key": "codiceContestoPagamento",
"value": "",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2022-01-05T17:35:42.874Z",
"_postman_exported_using": "Postman/7.36.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"value": "30205",
"enabled": true
},
{
"key": "importo_versamento",
"value": 100,
"enabled": true
},
{
"key": "codiceContestoPagamento",
"value": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "35f2759a-2cde-4351-9fda-2fe3305404e2",
"_postman_id": "c27c3288-555a-4f2b-a939-3acec35ff744",
"name": "NM3",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
Expand All @@ -15,9 +15,9 @@
"pm.test(\"Verify status code is 200\", () => {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Verify importoSingoloVersamento is 100\", () => {",
"pm.test(`Verify importoSingoloVersamento is ${pm.environment.get('importo_versamento')}`, () => {",
" const responseJson = pm.response.json();",
" pm.expect(responseJson.importoSingoloVersamento).to.eql(100);",
" pm.expect(responseJson.importoSingoloVersamento).to.eql(pm.environment.get('importo_versamento'));",
"",
" let codiceContestoPagamento = responseJson.codiceContestoPagamento;",
" pm.environment.set(\"codiceContestoPagamento\", codiceContestoPagamento );",
Expand Down Expand Up @@ -57,9 +57,9 @@
"pm.test(\"Activate status code is 200\", () => {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Activate importoSingoloVersamento is 1\", () => {",
"pm.test(`Activate importoSingoloVersamento is ${pm.environment.get('importo_versamento')}`, () => {",
" const responseJson = pm.response.json();",
" pm.expect(responseJson.importoSingoloVersamento).to.eql(1);",
" pm.expect(responseJson.importoSingoloVersamento).to.eql(pm.environment.get('importo_versamento'));",
"});",
"setTimeout(function(){}, 1000);",
""
Expand Down
20 changes: 12 additions & 8 deletions k6example/ws.sh → api-tests/ws.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
#!/bin/bash
usage=$1

env_file="ENV_TEST.postman_environment.json"
if [[ $2 ]]; then
if [[ -f $2 ]]; then
env_file=$2
else
echo "Error: environment file $2 does not exist"
exit 1
fi
fi

if [[ "$usage" =~ ^(postman|k6|paForNode|pspForNode)$ ]]; then
if [ "$usage" = "k6" ]
then
postman-to-k6 NM3.postman_collectionV1.json --environment ENV_TEST.postman_environment.json -o generated/script.js
postman-to-k6 NM3.postman_collectionV1.json --environment $env_file -o generated/script.js
k6 run --vus 10 --duration 5s generated/script.js
else
newman run NM3.postman_collection.json --environment=ENV_TEST.postman_environment.json --reporters cli
newman run NM3.postman_collection.json --environment=$env_file --reporters cli
fi
else
echo "Error: Argument for '$usage' is no allowed (typing postman or k6)" >&2
exit 1
fi






Loading