Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:opencrvs/opencrvs-countryconfig …
Browse files Browse the repository at this point in the history
…into ocrvs-6208-reject-registration
  • Loading branch information
naftis committed Oct 29, 2024
2 parents e520ffc + 7aa4d62 commit 812e31a
Show file tree
Hide file tree
Showing 14 changed files with 708 additions and 55 deletions.
142 changes: 110 additions & 32 deletions .github/workflows/auto-pr-to-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,100 @@ on:
description: 'PR number to process'
required: true
default: ''
dry_run:
description: 'Dry run'
required: false
default: false
type: boolean

jobs:
create-pr:
resolve-releases:
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.resolve-applicable-versions.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get PR details from workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
id: get_pr_details_dispatch
run: |
PR_NUMBER=${{ github.event.inputs.pr_number }}
PR_DATA=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/opencrvs/opencrvs-countryconfig/pulls/$PR_NUMBER)
echo "MILESTONE=$(printf '%s' $PR_DATA | jq -r '.milestone.title')" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Get PR details from event
if: ${{ github.event_name == 'pull_request' }}
id: get_pr_details_event
run: |
echo "MILESTONE=${{ github.event.pull_request.milestone.title }}" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Check for milestone and if release branch exists
continue-on-error: true
id: resolve-applicable-versions
run: |
if [ -z "${{ env.MILESTONE }}" ] || [ "${{ env.MILESTONE }}" = "null" ]; then
echo "No milestone set. Exiting."
exit 1
fi
filter_versions() {
local input_version=$1
# List remote branches, extract versions, and sort them semantically
versions=$(git ls-remote --heads origin 'release-*' | awk -F'release-' '{print $2}' | sort -V)
# Filter out versions less than the input version
filtered_versions=$(echo "$versions" | awk -v input="$input_version" '
function compare_versions(v1, v2) {
split(v1, a, /[.v]/);
split(v2, b, /[.v]/);
for (i = 2; i <= 4; i++) {
if (a[i] < b[i]) return -1;
if (a[i] > b[i]) return 1;
}
return 0;
}
{
if (compare_versions($0, input) >= 0) {
print $0
}
}')
# Keep only the highest patch version for each minor version
echo "$filtered_versions" | awk -F. '
{
minor = $1 "." $2;
patches[minor] = $0;
}
END {
for (minor in patches) {
print patches[minor];
}
}' | sort -V
}
versions=$(filter_versions "${{ env.MILESTONE }}")
json_array=$(echo "$versions" | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "matrix=$json_array" >> $GITHUB_OUTPUT
create-pr:
needs: resolve-releases
runs-on: ubuntu-22.04
if: ${{ always() && needs.resolve-releases.result == 'success' }}

strategy:
fail-fast: false
matrix:
version: ${{fromJson(needs.resolve-releases.outputs.matrix)}}

steps:
- name: Checkout repository
Expand All @@ -39,13 +128,12 @@ jobs:
echo "PR_ID=$(printf '%s' $PR_DATA | jq -r '.number')" >> $GITHUB_ENV
echo "PR_AUTHOR=$(printf '%s' $PR_DATA | jq -r '.user.login')" >> $GITHUB_ENV
echo "PR_MERGER=$(printf '%s' $PR_DATA | jq -r '.merged_by.login')" >> $GITHUB_ENV
echo "MILESTONE=$(printf '%s' $PR_DATA | jq -r '.milestone.title')" >> $GITHUB_ENV
echo "BASE_BRANCH=$(printf '%s' $PR_DATA | jq -r '.base.ref')" >> $GITHUB_ENV
echo "HEAD_BRANCH=$(printf '%s' $PR_DATA | jq -r '.head.ref')" >> $GITHUB_ENV
echo "PR_TITLE=$(printf '%s' $PR_DATA | jq -r '.title')" >> $GITHUB_ENV
echo "BASE_SHA=$(printf '%s' $PR_DATA | jq -r '.base.sha')" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Get PR details from event
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -54,7 +142,6 @@ jobs:
PR_NUMBER=${{ github.event.pull_request.number }}
echo "PR_ID=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "PR_AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
echo "MILESTONE=${{ github.event.pull_request.milestone.title }}" >> $GITHUB_ENV
echo "BASE_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
echo "HEAD_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "PR_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
Expand All @@ -64,40 +151,24 @@ jobs:
MERGED_BY_LOGIN=$(echo "$PR_DETAILS" | jq -r '.mergedBy.login')
echo "PR_MERGER=$MERGED_BY_LOGIN" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check for milestone and if release branch exists
continue-on-error: true
id: check_release_branch
run: |
if [ -z "${{ env.MILESTONE }}" ]; then
echo "No milestone set. Exiting."
exit 1
fi
RELEASE_BRANCH="release-${{ env.MILESTONE }}"
# Check if the release branch exists
if git ls-remote --heads origin $RELEASE_BRANCH | grep -q "refs/heads/$RELEASE_BRANCH"; then
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_ENV
else
echo "Release branch $RELEASE_BRANCH does not exist. Exiting."
exit 1
fi
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create and push the new branch for the PR
if: ${{ steps.check_release_branch.outcome == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
SEMANTIC_PR_TITLE="${{ env.PR_TITLE }}"
RELEASE_BRANCH="release-${{ matrix.version }}"
MILESTONE="${{ matrix.version }}"
# Check for semantic prefix
if [[ $SEMANTIC_PR_TITLE =~ ^(feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert|wip|merge)\: ]]; then
SEMANTIC_PR_TITLE="${BASH_REMATCH[1]}(${MILESTONE}): ${SEMANTIC_PR_TITLE#*: }"
else
SEMANTIC_PR_TITLE="🍒 Merge changes from PR #${{ env.PR_ID }} to ${{ env.RELEASE_BRANCH }}"
SEMANTIC_PR_TITLE="🍒 Merge changes from PR #${{ env.PR_ID }} to $RELEASE_BRANCH"
fi
PR_BODY="Automated PR to merge changes from develop to ${{ env.RELEASE_BRANCH }}"
PR_BODY="Automated PR to merge changes from develop to $RELEASE_BRANCH"
# Configure git
git config user.name "github-actions"
Expand All @@ -106,10 +177,10 @@ jobs:
# Fetch and checkout the release branch
git fetch --all --unshallow
git checkout ${{ env.RELEASE_BRANCH }}
git checkout $RELEASE_BRANCH
# Create a new branch for the PR
NEW_BRANCH="auto-pr-${{ env.RELEASE_BRANCH }}-${{ env.PR_ID }}-$RANDOM"
NEW_BRANCH="auto-pr-$RELEASE_BRANCH-${{ env.PR_ID }}-$RANDOM"
git checkout -b $NEW_BRANCH
echo "HEAD_BRANCH: ${{ env.HEAD_BRANCH }}"
Expand Down Expand Up @@ -154,6 +225,15 @@ jobs:
"
}
if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then
echo "This is a dry run."
echo "Would have pushed the new branch $NEW_BRANCH"
echo "PR title: $SEMANTIC_PR_TITLE"
echo "PR body:"
echo "$PR_BODY"
exit 0
fi
# Push the new branch
git push origin $NEW_BRANCH
Expand All @@ -167,6 +247,4 @@ jobs:
AUTHOR=${{ env.PR_MERGER }}
fi
fi
gh pr create --title "$SEMANTIC_PR_TITLE" --body "$PR_BODY" --head "$NEW_BRANCH" --base "${{ env.RELEASE_BRANCH }}" --assignee "$AUTHOR" --reviewer "$AUTHOR"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gh pr create --title "$SEMANTIC_PR_TITLE" --body "$PR_BODY" --head "$NEW_BRANCH" --base "$RELEASE_BRANCH" --assignee "$AUTHOR" --reviewer "$AUTHOR"
1 change: 1 addition & 0 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
- develop
- main
- 'release*'
workflow_dispatch:
inputs:
branch_name:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 1.7.0 Release candidate

### New features

- Update the translations for System user add/edit form, `Last name` to `User's surname` and `First name` to `User's first name` to make them less confusing for system users [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830)

### Bug fixes

- Protect individual certificate endpoint with token
Expand Down Expand Up @@ -117,6 +121,12 @@ INSERT CSV ROWS IN ENGLISH ONLY
- Github pipeline dedicated for reading secrets and variables from other environments now checks if GH_TOKEN is still valid before attempting other operations
- Remove unnecessary UI dividers that add in various sections of the declaration forms(e.g the Death, Birth and Marriage forms) [#244](https://github.com/opencrvs/opencrvs-countryconfig/pull/244)

## 1.5.2 (https://github.com/opencrvs/opencrvs-countryconfig/compare/v1.5.1...v1.5.2)

## Bug fixes

- Broken email alerts from low disk space are now fixed [293](https://github.com/opencrvs/opencrvs-countryconfig/pull/293)

## 1.5.0 (https://github.com/opencrvs/opencrvs-countryconfig/compare/v1.4.1...v1.5.0)

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ services:
- LOGIN_URL=https://login.{{hostname}}
- CLIENT_APP_URL=https://register.{{hostname}}
- DOMAIN={{hostname}}
- COUNTRY=${COUNTRY}
- COUNTRY=${COUNTRY:-FAR}
deploy:
labels:
- 'traefik.enable=true'
Expand Down
1 change: 0 additions & 1 deletion infrastructure/docker-compose.development-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ services:
environment:
- LANGUAGES=en,fr
- SENTRY_DSN=${SENTRY_DSN:-}
- COUNTRY=${COUNTRY}
- QA_ENV=true
- NODE_ENV=production

Expand Down
1 change: 0 additions & 1 deletion infrastructure/docker-compose.qa-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ services:
environment:
- LANGUAGES=en,fr
- SENTRY_DSN=${SENTRY_DSN:-}
- COUNTRY=${COUNTRY}
- QA_ENV=true
- NODE_ENV=production

Expand Down
4 changes: 2 additions & 2 deletions infrastructure/monitoring/elastalert/rules/alert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ filter:
should:
- term:
rule.name.keyword:
value: 'Available disk space in data partition'
value: 'Available disk space in root file system'
- term:
rule.name.keyword:
value: 'CPU under heavy load'
- term:
rule.name.keyword:
value: 'Low on available disk space'
value: 'Low on available disk space in data partition'
minimum_should_match: 1

alert: post2
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/server-setup/inventory/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ all:
users:
# @todo this is where you define which development team members have access to the server.
# If you need to remove access from someone, do not remove them from this list, but instead set their state: absent
- name: my-user
- name: ashikul
ssh_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFr/v3hUGEbc2wQsDLCmqLrwiz964yVrnLZ6kafemjmX8aRGLp1CNFvrZ674SLnXidZGMkx9d5xVvv8IdFR3R50MqSqfolF43MV34/JVHjQHh9Vk4MJT/3GIaeNmr2GQ/38qAmt2BQn1ecnb7FjNO2bFvHokLhm2wCXt+A4avuTgJe0p4e6uu01IHeIzDb5sPzZ3ID0h6jJnjEDcET+Lf5NGpCjn7YKhLhBWSSl9cXQdOGLzNzg3aBk32kgJ1beP1funSeVd0jniJPZeZRC1G/kRdqBUOHKiENtwgquzZxXzdHkZV9+4mF7YGlx6LpQdNuDpW7JADtYNldtdbexdyfrgNoRzKwyMmaKNDbeHd1FsIHSDJmGm9hCoLTM2dEtsGzgghfe0tat8sOWmsj5v2en0V8rKV+w8OQEmHtaQkgMjqmZaAnd8uWiB2xIbrUuax5Pq8zkj37xnfbRxUPOEkMlOUbhh1wzGbqeUEB7nbv/vXZxwC0b7ryMk5egBP+0ZRONsdib9RkSTr3B9uSb7iTOQftdhy+CTqqOq+6s+TyC2qnu12B1WZb9sx9jQl0mBHd9gx/FgYDs8jfIr2vF4jRkejW/moaVqvCd/FLyS91eCMXQjIXdGKWKPUUL7GEBqdZRLnYSJOqgPp9sk1+NEvMabTXlWmoUjaShq8z+o7JsQ== nileeeem36@gmail.com
state: present
sudoer: true
enable_backups: false
docker-manager-first:
hosts:
dev: # @todo set this to be the hostname of your target server
ansible_host: '44.44.44.44' # @todo set this to be the IP address of your server
ashikulland-development: # @todo set this to be the hostname of your target server
ansible_host: '139.59.27.157' # @todo set this to be the IP address of your server
data_label: data1 # for manager machines, this should always be "data1"

# Development servers are not configured to use workers.
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"dev": "yarn start",
"precommit": "lint-staged",
"test": "echo 'no tests, yet'",
"test": "vitest",
"test:compilation": "tsc --noEmit",
"lint": "eslint -c .eslintrc.js",
"start": "cross-env NODE_ENV=development NODE_OPTIONS=--dns-result-order=ipv4first nodemon --exec ts-node -r tsconfig-paths/register src/index.ts",
Expand All @@ -43,19 +43,21 @@
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"cypress-xpath": "^2.0.1",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint": "^8.43.0",
"husky": "1.0.0-rc.13",
"inquirer": "^9.2.12",
"js-yaml": "^4.1.0",
"kleur": "^4.1.5",
"libsodium-wrappers": "^0.7.13",
"lint-staged": "^7.1.0",
"node-ssh": "^13.2.0",
"nodemon": "^2.0.22",
"pino-pretty": "^11.0.0",
"prettier": "^2.8.8",
"react-intl": "^6.4.3"
"react-intl": "^6.4.3",
"vitest": "^2.1.2"
},
"dependencies": {
"@faker-js/faker": "^6.0.0-alpha.5",
Expand All @@ -70,8 +72,8 @@
"@types/hapi__hapi": "^20.0.0",
"@types/jwt-decode": "^2.2.1",
"@types/lodash": "^4.14.117",
"@types/node-fetch": "^2.6.2",
"@types/node": "^10.12.5",
"@types/node-fetch": "^2.6.2",
"@types/nodemailer": "^6.4.14",
"app-module-path": "^2.2.0",
"chalk": "^2.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/form/addresses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
{
// INFORMANT ADDRESS FIELDS
precedingFieldId:
'birth.informant.informant-view-group.informant-nid-seperator',
'birth.informant.informant-view-group.informantBirthRegistrationNumber',
configurations: [
{
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
Expand Down
7 changes: 0 additions & 7 deletions src/form/birth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,6 @@ export const birthForm: ISerializedForm = {
hideIfNidIntegrationEnabled.concat(hideIfInformantMotherOrFather),
true
),
// preceding field of address fields
divider('informant-nid-seperator', [
{
action: 'hide',
expression: informantNotMotherOrFather
}
]),
// ADDRESS FIELDS WILL RENDER HERE
divider('informant-address-seperator', [
{
Expand Down
4 changes: 3 additions & 1 deletion src/translations/client.csv
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,6 @@ form.field.label.fetchRegistrationModalInfo,,Birth Registration Number,Numéro d
form.field.label.fileSizeError,,File size must be less than 2MB,La taille du fichier doit être inférieure à 2 Mo
form.field.label.fileUploadError,,{type} supported image only,{type} format d'images accepté
form.field.label.firstName,,First name(s),Prénom(s)
form.field.label.firstNameEN,,First name(s),Prénom(s)
form.field.label.firstNames,,First name(s),Prénom(s)
form.field.label.healthInstitution,,Health Institution,Institution de santé
form.field.label.hospital,,Hospital,Hôpital
Expand Down Expand Up @@ -1161,9 +1160,11 @@ form.field.label.uploadFile,,Upload,Télécharger
form.field.label.urban,,Urban,Urbain
form.field.label.userAttachmentSection,,Signature,Signature
form.field.label.userDevice,,Device,Dispositif
form.field.label.userFirstName,,User's first name,Prénom de l'utilisateur
form.field.label.userSignatureAttachment,,User's signature,Signature de l'utilisateur
form.field.label.userSignatureAttachmentDesc,,Ask the user to sign a piece of paper and then scan or take a photo,"Demandez à l'utilisateur de signer une feuille de papier, puis scannez ou prenez une photo."
form.field.label.userSignatureAttachmentTitle,,Upload signature,Joindre la signature
form.field.label.userSurname,,User's surname,Nom de famille de l'utilisateur
form.field.label.verbalAutopsy,,Verbal autopsy,Autopsie verbale
form.field.label.verbalAutopsyReport,,Verbal autopsy report,Rapport d'autopsie verbal
form.field.label.weightAtBirth,,Weight at birth,Poids à la naissance
Expand Down Expand Up @@ -1820,6 +1821,7 @@ search.locationNotFound,Label for location not found,Location Not Found,Emplacem
search.noDeclarations,The text when there is no declaration to review,No declarations to review,Aucune déclaration à examiner
search.noResultFor,The no result text,No results for ”{param}”,Aucun résultat pour “{param}”
search.noResults,Text to display if the search return no results for the current filters,No result to display,Aucun résultat à afficher
search.placeholder,Placeholder text of search input,Name of query,Nom de la requête
search.removeBbookmarkAdvancedSearchModalBody,Modal body for remove bookmark advacnced search,This advanced search bookmark will be removed from the side bar shortcut,Ce signet de recherche avancée sera supprimé du raccourci de la barre latérale
search.removeBookmarkAdvancedSearchModalTitle,Modal title for remove bookmark advacnced search,Remove search query?,Supprimer la requête de recherche ?
search.results,Results label at the top of the data table component,Results,Résultats
Expand Down
Loading

0 comments on commit 812e31a

Please sign in to comment.