Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Deniallugo authored Aug 18, 2021
2 parents 52bebc8 + 5466c2e commit f6efc17
Show file tree
Hide file tree
Showing 132 changed files with 3,289 additions and 3,564 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
deployment:

env:
DEPLOY_APPS: -l name=server -l name=prover -l name=explorer
DEPLOY_APPS: -l name=server -l name=prover

jobs:
pre:
Expand Down
133 changes: 66 additions & 67 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- breaking

env:
DEPLOY_APPS: -l name=server -l name=prover -l name=explorer
DEPLOY_APPS: -l name=server -l name=prover

jobs:
pre:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
echo $(pwd)/bin >> $GITHUB_PATH
- name: init
run: |
cargo sqlx --version || cargo install --version=0.2.0 sqlx-cli
cargo sqlx --version || cargo install sqlx-cli
zk
zk run yarn
cp etc/tokens/{test,localhost}.json
Expand All @@ -53,72 +53,71 @@ jobs:
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
zk docker push rust
## !!! TODO: fix stage and enable deployments back.
## !!! TODO: breaking deployment is not supported.
# deploy:
# name: Deploy to the Stage enviroment
# runs-on: [k8s, deployer, stage]
# needs: [pre, build-images]
# Reminder: when disabling the deploy stage - comment the whole job out!
deploy:
name: Deploy to the Stage enviroment
runs-on: [k8s, deployer, stage]
needs: [pre, build-images]

# container:
# image: dysnix/kubectl:v1.19-gcloud
container:
image: dysnix/kubectl:v1.19-gcloud

# env:
# KUBECONF: ${{ secrets.KUBECONF_STAGE }}
# IMAGE_TAG: ${{ needs.pre.outputs.shortRev }}
# HFENV: stage
env:
KUBECONF: ${{ secrets.KUBECONF_STAGE }}
IMAGE_TAG: ${{ needs.pre.outputs.shortRev }}
HFENV: 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
# -
# 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 ~
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
-
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 }}
# -
# name: Notify to Mattermost (on failure)
# uses: tferreira/matterfy@releases/v1
# if: failure()
# with:
# type: ${{ job.status }}
# job_name: '*Deployment to stage failed*'
# icon_emoji: octocat
# channel: 'matterlabs-alerts'
# url: ${{ secrets.MATTERMOST_WEBHOOK }}
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 }}
-
name: Notify to Mattermost (on failure)
uses: tferreira/matterfy@releases/v1
if: failure()
with:
type: ${{ job.status }}
job_name: '*Deployment to stage failed*'
icon_emoji: octocat
channel: 'matterlabs-alerts'
url: ${{ secrets.MATTERMOST_WEBHOOK }}
95 changes: 95 additions & 0 deletions .github/workflows/update-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Update Config
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment where to update the config'
required: true
ref:
description: 'Branch or tag to fetch configs from'
required: true

defaults:
run:
shell: bash -leo pipefail {0}

jobs:
pre:
runs-on: [k8s, stage]
steps:
- uses: actions/checkout@v2
-
id: config
run: |
environment=${{ github.event.inputs.environment }}
ref=${{ github.event.inputs.ref }}
echo "::set-output name=environment::${environment}"
echo "::set-output name=ref::${ref}"
-
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ steps.config.outputs.ref }}
regex: '^((v[0-9]+\.[0-9]+\.[0-9])(-?.*)?)$'
-
name: Map runtime environment data
id: envMap
uses: kanga333/[email protected]
with:
key: ${{ steps.config.outputs.environment }}
export_to: output
mode: overwrite
map: |
{
".*": {
"hfEnv": "${{ steps.config.outputs.environment }}",
"kubeConf": "KUBECONF_STAGE",
"runner": "stage",
"namespace": "${{ steps.config.outputs.environment }}"
},
"^rinkeby$": { "kubeConf": "KUBECONF_TESTNET", "runner": "testnet" },
"^ropsten$": { "kubeConf": "KUBECONF_TESTNET", "runner": "testnet" },
"^mainnet$": { "kubeConf": "KUBECONF_MAINNET", "runner": "mainnet", "hfEnv": "prod", "namespace": "zksync" }
}
outputs:
environment: ${{ steps.config.outputs.environment }}
kubeConf: ${{ steps.envMap.outputs.kubeConf }}
hfEnv: ${{ steps.envMap.outputs.hfEnv }}
namespace: ${{ steps.envMap.outputs.namespace }}
runner: ${{ steps.envMap.outputs.runner }}
configTag: ${{ steps.config.outputs.ref }}
isTag: ${{ steps.regex-match.outputs.group1 != '' }}

updateConfig:
if: ${{ needs.pre.outputs.isTag == 'true' }}
name: update config
needs: [pre]
runs-on: [k8s, deployer, "${{ needs.pre.outputs.runner }}"]
container:
image: dysnix/kubectl:v1.19-gcloud
env:
KUBECONF: ${{ secrets[needs.pre.outputs.kubeConf] }}
ENVFILE: ./compiled_envs/${{ needs.pre.outputs.environment }}.env
steps:
-
name: Create ~/.kube/config
run: mkdir -p ~/.kube && echo "$KUBECONF" | base64 -d > ~/.kube/config
-
name: Clone configs
uses: actions/checkout@v2
with:
repository: matter-labs/configs
path: configs
ref: ${{ needs.pre.outputs.configTag }}
token: ${{ secrets.GH_TOKEN }}
-
name: Update Server Config
working-directory: configs
run: |
sudo apk --no-cache add yarn
./bin/config
./bin/config compile ${{ needs.pre.outputs.environment }}
kubectl delete configmap -n ${{ needs.pre.outputs.namespace }} server-env-custom || /bin/true
kubectl create configmap -n ${{ needs.pre.outputs.namespace }} server-env-custom --from-env-file=${{ env.ENVFILE }}
# kubectl delete pod -n ${{ needs.pre.outputs.namespace }} -l app.kubernetes.io/instance=server
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "sdk/binaryen"]
path = sdk/binaryen
url = git@github.com:WebAssembly/binaryen.git
url = https://github.com/WebAssembly/binaryen.git
Loading

0 comments on commit f6efc17

Please sign in to comment.