Skip to content

Cleanup e2e repo(ocrvs-8922) #46

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

148 changes: 148 additions & 0 deletions .github/workflows/deploy-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Deploy Dependencies
run-name: Deploy dependencies ${{ inputs.stack }} with core=${{ inputs.core-image-tag }} country config=${{ inputs.countryconfig-image-tag }}
on:
workflow_dispatch:
inputs:
core-image-tag:
description: Core DockerHub image tag
required: true
default: 'v1.6.0'
countryconfig-image-tag:
description: Your Country Config DockerHub image tag
required: true
stack:
type: string
description: Stack name
required: true

jobs:
deploy:
environment: ${{ inputs.stack }}
runs-on: ubuntu-22.04
concurrency:
group: deploy
cancel-in-progress: false
outputs:
outcome: ${{ steps.deploy.outcome }}
timeout-minutes: 60
steps:
- name: Check if vars.BLOCK_NEW_DEPLOYMENTS is set to true
run: |
if [[ "${{ vars.BLOCK_NEW_DEPLOYMENTS }}" == "true" ]]; then
echo "BLOCK_NEW_DEPLOYMENTS in Github environment settings is set to true, exiting..."
echo "Set the variable to anything other than 'true' and redeploy"
echo "https://github.com/opencrvs/e2e/settings/environments"
exit 1
fi
- name: Generate summary
run: |
echo "Deploying environment to https://${{ inputs.stack }}.${{ vars.DOMAIN }}" >> $GITHUB_STEP_SUMMARY
echo "Core image tag: ${{ inputs.core-image-tag }}" >> $GITHUB_STEP_SUMMARY
echo "Country config image tag: ${{ inputs.countryconfig-image-tag }}" >> $GITHUB_STEP_SUMMARY

- name: Clone core
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: 'opencrvs/opencrvs-core'
path: './opencrvs-core'

- name: Clone country config resource package
uses: actions/checkout@v3
with:
fetch-depth: 1
path: './${{ github.event.repository.name }}'

- name: Checkout country branch
run: |
cd ${{ github.event.repository.name }}
cd ../

- name: Checkout core branch
run: |
cd opencrvs-core
git checkout ${{ inputs.core-image-tag }}

- name: Read known hosts
run: |
cd ${{ github.event.repository.name }}
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
sed -i -e '$a\' ./infrastructure/known-hosts
cat ./infrastructure/known-hosts >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ env.KNOWN_HOSTS }}

- name: Unset KNOWN_HOSTS variable
run: |
echo "KNOWN_HOSTS=" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Export all secrets and environment variables
run: |
cd ./${{ github.event.repository.name }}

SECRETS_JSON_WITH_NEWLINES=$(cat<<EOF
${{ toJSON(secrets) }}
EOF)

#
# Secrets & variables with newlines are filtered out automatically
# This includes SSH_KEY and KNOWN_HOSTS
#
while IFS= read -r secret; do
echo "$secret" >> .env.${{ inputs.stack }}
done < <(
jq -r '
to_entries |
map(
select(.value | test("\n") | not) |
"\(.key)=\"\(.value)\""
) |
.[]' <<< "$SECRETS_JSON_WITH_NEWLINES"
)

VARS_JSON_WITH_NEWLINES=$(cat<<EOF
${{ toJSON(vars) }}
EOF)

while IFS= read -r var; do
echo "$var" >> .env.${{ inputs.stack }}
done < <(
jq -r '
to_entries |
map(
select(.value | test("\n") | not) |
"\(.key)=\"\(.value)\""
) |
.[]' <<< "$VARS_JSON_WITH_NEWLINES"
)

- name: Deploy to ${{ inputs.stack }}
id: deploy
run: |
cd ./${{ github.event.repository.name }}
yarn install
yarn deploy \
--clear_data=no \
--environment=${{ inputs.stack }} \
--host=${{ vars.DOMAIN }} \
--stack=${{ inputs.stack }} \
--update-dependencies=true \
--ssh_host=${{ vars.SSH_HOST || secrets.SSH_HOST }} \
--ssh_port=${{ vars.SSH_PORT || secrets.SSH_PORT }} \
--ssh_user=${{ secrets.SSH_USER }} \
--version=${{ inputs.core-image-tag }} \
--country_config_version=${{ inputs.countryconfig-image-tag }} \
--replicas=${{ vars.REPLICAS }}


98 changes: 0 additions & 98 deletions .github/workflows/get-secret-from-environment.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
environment:
type: choice
description: Machine to provision
default: qa
default: e2e
required: true
options:
- development
- staging
- qa
- e2e
- production
- backup
- jump
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/reset-2fa.yml

This file was deleted.

Loading