forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
4,504 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: Deploy Apps | ||
|
||
on: | ||
deployment: | ||
|
||
env: | ||
DEPLOY_APPS: -l name=server -l name=prover -l name=explorer | ||
|
||
jobs: | ||
pre: | ||
runs-on: [k8s, stage] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- | ||
id: print | ||
run: echo "::set-output name=shortRev::$(git rev-parse --short HEAD)" | ||
- | ||
uses: actions-ecosystem/action-regex-match@v2 | ||
id: regex-match | ||
with: | ||
text: ${{ github.ref }} | ||
regex: '^refs\/tags\/(v[0-9]+\.[0-9]+\.[0-9](-?.*)?)$' | ||
- | ||
name: Map runtime environment data | ||
uses: kanga333/[email protected] | ||
with: | ||
key: "${{ github.event.deployment.environment }}" | ||
map: | | ||
{ | ||
"mainnet": { | ||
"KUBECONF": "KUBECONF_MAINNET", | ||
"HFENV": "zksync-prod", | ||
"RUNNER": "mainnet" | ||
}, | ||
"rinkeby": { | ||
"KUBECONF": "KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "testnet" | ||
}, | ||
"ropsten": { | ||
"KUBECONF": "KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "testnet" | ||
}, | ||
".*": { | ||
"KUBECONF": "KUBECONF_STAGE", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "stage" | ||
} | ||
} | ||
- | ||
name: Cancel deployment (deployment tag missmatch) | ||
if: ${{ steps.regex-match.outputs.group1 == '' }} | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: failure | ||
deployment_id: ${{ github.event.deployment.id }} | ||
|
||
outputs: | ||
shortRev: ${{ steps.print.outputs.shortRev }} | ||
kubeConf: ${{ env.KUBECONF }} | ||
hfEnv: ${{ env.HFENV }} | ||
runner: ${{ env.RUNNER }} | ||
isTag: ${{ steps.regex-match.outputs.group1 != '' }} | ||
|
||
deploy: | ||
name: Deploy Apps | ||
runs-on: [k8s, deployer, "${{ needs.pre.outputs.runner }}"] | ||
needs: pre | ||
if: ${{ needs.pre.outputs.isTag == 'true' }} | ||
|
||
container: | ||
image: dysnix/kubectl:v1.16-gcloud | ||
|
||
env: | ||
IMAGE_TAG: ${{ needs.pre.outputs.shortRev }} | ||
KUBECONF: ${{ secrets[needs.pre.outputs.kubeConf] }} | ||
HFENV: ${{ needs.pre.outputs.hfEnv }} | ||
|
||
steps: | ||
- | ||
name: Create ~/.kube/config | ||
run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config | ||
- | ||
name: Clone helm-infra | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: matter-labs/helm-infra | ||
path: helm-infra | ||
ref: master | ||
token: ${{ secrets.GH_TOKEN }} | ||
- | ||
name: Deploy apps | ||
working-directory: helm-infra | ||
run: | | ||
## copy helm plugins over (from dysnix/kubectl, don't forget)!!! | ||
cp -r /dysnix/kubectl/.local /dysnix/kubectl/.cache ~ | ||
UPDATE_REPOS=y helmfile -e $HFENV repos | ||
helmfile -e $HFENV $DEPLOY_APPS apply --args "timeout 180s" | ||
- | ||
name: Update deployment status (success) | ||
if: success() | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: success | ||
deployment_id: ${{ github.event.deployment.id }} | ||
- | ||
name: Update deployment status (failure) | ||
if: failure() | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: failure | ||
deployment_id: ${{ github.event.deployment.id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Deploy Stage | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
env: | ||
DEPLOY_APPS: -l name=server -l name=prover -l name=explorer | ||
|
||
jobs: | ||
pre: | ||
runs-on: [k8s, stage] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: print | ||
run: echo "::set-output name=shortRev::$(git rev-parse --short HEAD)" | ||
|
||
outputs: | ||
shortRev: ${{ steps.print.outputs.shortRev }} | ||
|
||
build-images: | ||
name: Build and Push Docker Images | ||
runs-on: [self-hosted, MAIN] | ||
needs: pre | ||
|
||
## Required services | ||
services: | ||
postgres: | ||
image: postgres:10.4 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup-env | ||
run: | | ||
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV | ||
echo CI=1 >> $GITHUB_ENV | ||
echo $(pwd)/bin >> $GITHUB_PATH | ||
- name: init | ||
run: | | ||
cargo sqlx --version || cargo install --version=0.2.0 sqlx-cli | ||
zk | ||
zk run yarn | ||
cp etc/tokens/{test,localhost}.json | ||
zk run verify-keys unpack | ||
zk db basic-setup | ||
- name: update-images | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
zk docker push rust | ||
zk docker push nginx | ||
deploy: | ||
name: Deploy to the Stage enviroment | ||
runs-on: [k8s, deployer, stage] | ||
needs: [pre, build-images] | ||
|
||
container: | ||
image: dysnix/kubectl:v1.16-gcloud | ||
|
||
env: | ||
KUBECONF: ${{ secrets.KUBECONF_STAGE }} | ||
IMAGE_TAG: ${{ needs.pre.outputs.shortRev }} | ||
HFENV: zksync-stage | ||
|
||
steps: | ||
- | ||
name: Create ~/.kube/config | ||
run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config | ||
- | ||
name: Clone helm-infra | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: matter-labs/helm-infra | ||
path: helm-infra | ||
ref: master | ||
token: ${{ secrets.GH_TOKEN }} | ||
- | ||
uses: chrnorm/deployment-action@releases/v1 | ||
name: Create GitHub deployment | ||
id: deployment | ||
with: | ||
token: "${{ github.token }}" | ||
environment: stage | ||
# TODO fix stage and resume deploy to stage | ||
# - | ||
# name: Deploy apps | ||
# working-directory: helm-infra | ||
# run: | | ||
# copy helm plugins over (from dysnix/kubectl, don't forget)!!! | ||
# cp -r /dysnix/kubectl/.local /dysnix/kubectl/.cache ~ | ||
# | ||
# UPDATE_REPOS=y helmfile -e $HFENV repos | ||
# helmfile -e $HFENV $DEPLOY_APPS apply --args "timeout 180s" | ||
- | ||
name: Update deployment status (success) | ||
if: success() | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: success | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
- | ||
name: Update deployment status (failure) | ||
if: failure() | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: failure | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.