Deploy registry as svc (#2155)

* Admin, restful EPP and API deployed as different services.
* Docker-image builded from same commit for every service.
This commit is contained in:
Keijo Raamat 2021-09-23 14:26:52 +03:00 committed by GitHub
parent 6a41762904
commit 20f97a92c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 19 deletions

View file

@ -110,17 +110,22 @@ jobs:
export KUBECONFIG=./kubeconfig
helm repo add eisrepo https://internetee.github.io/helm-charts/
helm repo update
helm upgrade --install registry-st-"$PR_REF" --set image.tag="$SHORT_TAG",reference="$PR_REF" eisrepo/registry -n registry-staging
helm upgrade --install reg-admin-"$PR_REF" --set image.tag="$SHORT_TAG",reference="$PR_REF" eisrepo/registry-admin -n reg-admin-staging
helm upgrade --install repp-"$PR_REF" --set image.tag="$SHORT_TAG",reference="$PR_REF" eisrepo/registry-epp -n epp
helm upgrade --install reg-api-"$PR_REF" --set image.tag="$SHORT_TAG",reference="$PR_REF" eisrepo/registry-api -n reg-api
rm kubeconfig
echo "Setting up URLs"
echo "server obs.tld.ee
zone pilv.tld.ee
update add registry-"$PR_REF".pilv.tld.ee. 3600 CNAME riigi.pilv.tld.ee.
update add reg-admin-"$PR_REF".pilv.tld.ee. 3600 CNAME riigi.pilv.tld.ee.
update add repp-"$PR_REF".pilv.tld.ee. 3600 CNAME riigi.pilv.tld.ee.
update add reg-api-"$PR_REF".pilv.tld.ee. 3600 CNAME riigi.pilv.tld.ee.
send
" | nsupdate -k ~/Kgh-runner.infra.tld.ee.+165+27011.key
if [ "$?" -eq "0" ]; then
echo "CNAME update success"
echo "CNAME updates were successful"
else
echo "CNAME update failed"
echo "CNAME updates failed"
fi
EOSSH
@ -130,9 +135,13 @@ jobs:
NOTIFICATION_URL: ${{ secrets.NOTIFICATION_URL}}
run: |
curl -i -X POST --data-urlencode 'payload={
"text": "##### Build and deploy from pull request has been succesful :tada:\n
| Project | Branch | :net: |
|:-----------|:----------------------:|:--------------------------------------:|
| **'$REPO'**|'${{ github.head_ref }}'| https://registry-'$PR_REF'.pilv.tld.ee |
"text": "\n##### A pull request from ['${{ github.head_ref }}'](https://github.com/internetee/registry/pull/'$PR_REF') to master has been deployed :tada:\n
|Service | :net: |
|:------------|:---------------------------------------:|
| **Admin** | https://reg-admin-'$PR_REF'.pilv.tld.ee |
| **repp** | https://repp-'$PR_REF'.pilv.tld.ee |
| **API** | https://reg-api-'$PR_REF'.pilv.tld.ee |
Please note that the API is only accessible from Riigipilv.
"
}' $NOTIFICATION_URL

View file

@ -2,7 +2,7 @@ name: remove-staging-after-pull-request
on:
pull_request:
types: [closed]
types: [closed, converted_to_draft, locked]
paths-ignore:
- 'CHANGELOG.md'
- 'README.md'
@ -10,7 +10,7 @@ on:
jobs:
delete:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04
steps:
@ -70,28 +70,35 @@ jobs:
bash
cd "$REPO"/"$PR_REF"
export KUBECONFIG=./kubeconfig
helm delete registry-st-"$PR_REF" -n registry-staging
helm delete reg-admin-"$PR_REF" -n reg-admin-staging
helm delete repp-"$PR_REF" -n epp
helm delete reg-api-"$PR_REF" -n reg-api
rm kubeconfig
echo "server obs.tld.ee
zone pilv.tld.ee
update delete registry-"$PR_REF".pilv.tld.ee.
update delete reg-admin-"$PR_REF".pilv.tld.ee.
update delete repp-"$PR_REF".pilv.tld.ee.
update delete reg-api-"$PR_REF".pilv.tld.ee.
send
" | nsupdate -k ~/Kgh-runner.infra.tld.ee.+165+27011.key
if [ "$?" -eq "0" ]; then
echo "CNAME update success"
echo "CNAME updates were successful"
else
echo "CNAME update failed"
echo "CNAME updates failed"
fi
EOSSH
- name: Notify developers
timeout-minutes: 1
env:
NOTIFICATION_URL: ${{ secrets.NOTIFICATION_URL}}
run: |
curl -i -X POST --data-urlencode 'payload={
"text": "##### Pull request was succesful, it has been merged :bowtie:\n
| Project | Branch | :net: |
|:-----------|:----------------------:|:------------------------------------------:|
| **'$REPO'**|'${{ github.head_ref }}'| ~~https://registry-'$PR_REF'.pilv.tld.ee~~ |
"text": "##### [Pull request](https://github.com/internetee/registry/pull/'$PR_REF') was succesful, it has been merged :bowtie:\n
| Registry | '${{ github.head_ref }}' |
|:-----------|:-------------------------------------------:|
| **Admin** | ~~https://reg-admin-'$PR_REF'.pilv.tld.ee~~ |
| **API** | ~~https://reg-api-'$PR_REF'.pilv.tld.ee~~ |
| **REPP** | ~~https://repp-'$PR_REF'.pilv.tld.ee~~ |
"
}' $NOTIFICATION_URL