Skip to content

Commit

Permalink
Merge branch 'master' into elasticsearch-8
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantacruz committed Aug 31, 2023
2 parents af86568 + a06949f commit 7b583ca
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 86 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
fetch-depth: 0
- name: fetch head of branch to ensure semantic can run
run: git pull origin $GITHUB_REF
- name: install semantic dependecies
run: npm install conventional-changelog-conventionalcommits
- name: create release rules
run: helm-chart/release-rules.sh
- uses: cycjimmy/semantic-release-action@v3
- uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
working_directory: ./helm-chart
extra_plugins: |
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/integration-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,48 @@ jobs:
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends curl helm
sudo apt-get install -y --no-install-recommends curl unzip
- name: setup helm
uses: azure/setup-helm@v3
- name: cleanup
run: |
helm list release -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} | grep integration | xargs -I env -n helm delete env -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} --debug --timeout 10m0s
helm list -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} | grep integration | cut -f 1 -d " " | xargs -I env -n 1 helm delete env -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} --debug --timeout 10m0s
database-setup:
permissions:
contents: 'read'
id-token: 'write'
runs-on: sefaria-integrations
container: us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT}}/containers/hosted-runner:latest
steps:
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
- name: Setup base utils
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends curl
- name: Set up yq
run: |
curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O
sudo mv yq_linux_amd64 /usr/bin/yq
chmod +x /usr/bin/yq
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
token_format: 'access_token'
workload_identity_provider: 'projects/${{ secrets.DEV_GKE_PROJECT_ID}}/locations/global/workloadIdentityPools/github/providers/github'
service_account: '${{ secrets.DEV_GKE_SA }}'
version: '>= 363.0.0'
- name: Setup kubectl
uses: azure/setup-kubectl@v3
- name: Setup mongodb-tools
run: |
curl -S https://fastdl.mongodb.org/tools/db/$MONGO_DEB -O
sudo apt install ./$MONGO_DEB
mongorestore --version
env:
MONGO_DEB: mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
- name: Get latest Backup
run: gsutil -q cp gs://sefaria-mongo-backup/dump.tar.gz dump.tar.gz
- name: Extract Backup
run: tar xzvf dump.tar.gz -C .
- name: Restore Backup
run: |
. <(kubectl get secret local-settings-secrets -n default -o yaml | yq -o=shell '.data | map_values(@base64d)')
. <( kubectl get secret local-settings-secrets -n default -o yaml | yq -o=shell '.data | map_values(@base64d)')
echo "::add-mask::$MONGO_HOST"
echo "::add-mask::$MONGO_REPLICASET_NAME"
echo "::add-mask::$SEFARIA_DB_USER"
Expand Down
48 changes: 16 additions & 32 deletions .github/workflows/integration-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
date: ${{ steps.data.outputs.date }}
commit: ${{ steps.get-sha.outputs.sha_short }}
branch: ${{ steps.branch-name.outputs.current_branch }}
runner-image: us-east1-docker.pkg.dev/${{ secrets.DEV_PROJECT}}/containers/hosted-runner:latest
steps:
- uses: actions/checkout@v2
- name: Get current date
Expand Down Expand Up @@ -152,59 +153,42 @@ jobs:
file: ./build/${{ matrix.app }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-test-environment:
run-tests:
needs:
- build-derived
- variables
permissions:
contents: 'read'
id-token: 'write'
runs-on: sefaria-integrations
container: us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT}}/containers/hosted-runner:latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup base utils
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends helm
- name: Authenticate GHA Runner To Target Cluster
uses: google-github-actions/get-gke-credentials@v0
with:
cluster_name: ${{secrets.DEV_GKE_CLUSTER}}
location: ${{secrets.DEV_GKE_REGION}}
project_id: ${{secrets.DEV_GCP_PROJECT}}
sudo apt-get install -y --no-install-recommends curl unzip
- name: Setup kubectl
uses: azure/setup-kubectl@v3
- name: setup helm
uses: azure/setup-helm@v3
- name: Set up yq
run: |
curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O
sudo mv yq_linux_amd64 /usr/bin/yq
chmod +x /usr/bin/yq
- name: Deploy Sandbox
run: ./build/ci/integration-helm-deploy.sh build/ci/integration-values.yaml
env:
GIT_COMMIT: "${{ needs.variables.outputs.commit }}"
BRANCH: "${{ needs.variables.outputs.branch }}"
PROJECT_ID: "${{ secrets.DEV_PROJECT }}"
NAMESPACE: "${{secrets.DEV_SANDBOX_NAMESPACE}}"
run-tests:
name: "Run Integration Tests"
needs:
- deploy-test-environment
- variables
permissions:
contents: 'read'
id-token: 'write'
runs-on: sefaria-integrations
container: us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT}}/containers/hosted-runner:latest
steps:
- name: Wait for env
run: while [[ $( curl -s -o /dev/null -w "%{http_code}" "nginx-integration-${{ needs.variables.outputs.commit }}.${{secrets.DEV_SANDBOX_NAMESPACE}}/texts") != "200" ]]; do sleep 10; done
timeout-minutes: 5
- name: Run tests
run: curl "nginx-integration-${{ needs.variables.outputs.commit }}.${{secrets.DEV_SANDBOX_NAMESPACE}}"
cleanup:
name: "Clean up Integration test environment"
needs:
- run-tests
- variables
runs-on: sefaria-integrations
container: us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT}}/containers/hosted-runner:latest
permissions:
contents: 'read'
id-token: 'write'
steps:
run: if [[ $( curl -s -o /dev/null -w "%{http_code}" "nginx-integration-${{ needs.variables.outputs.commit }}.${{secrets.DEV_SANDBOX_NAMESPACE}}/texts") != "200" ]]; then exit 1; fi
- name: Uninstall
run: helm delete integration-${{ needs.variables.outputs.commit }} -n ${{ secrets.DEV_SANDBOX_NAMESPACE }} --debug --timeout 10m0s
38 changes: 3 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,11 @@ jobs:
version: ${{ steps.releaseVersion.outputs.releaseVersion }}
steps:
- uses: actions/checkout@v3
- run: npm install conventional-changelog-conventionalcommits
- uses: codfish/semantic-release-action@v2
- uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
repository_url: ${{ github.repositoryUrl }}
plugins: |
[
['@semantic-release/commit-analyzer', {
"preset": "conventionalcommits",
"releaseRules": [
{"type": "static", "release": "patch"},
{"type": "chore", "release": "patch"},
{"type": "helm", "release": false}
]
}],
['@semantic-release/release-notes-generator', {
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "hidden": true},
{"type": "docs", "hidden": true},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true},
{"type": "static", "section": "Static Content"},
{"type": "helm", "hidden": true}
]
},
}],
['@semantic-release/github', {
"successComment": false,
"failTitle": false
}]
]
extra_plugins: |
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: check version was generated
Expand Down
34 changes: 34 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins: [
['@semantic-release/commit-analyzer', {
"preset": "conventionalcommits",
"releaseRules": [
{"type": "static", "release": "patch"},
{"type": "chore", "release": "patch"},
{"type": "helm", "release": false}
]
}],
['@semantic-release/release-notes-generator', {
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "hidden": true},
{"type": "docs", "hidden": true},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true},
{"type": "static", "section": "Static Content"},
{"type": "helm", "hidden": true}
]
},
}],
['@semantic-release/github', {
"successComment": false,
"failTitle": false
}]
]
branches: [
{name: 'master'},
]
4 changes: 2 additions & 2 deletions build/ci/integration-helm-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ yq e -i '.nodejs.containerImage.tag = strenv(TAG)' $1
yq e -i '.nginx.containerImage.tag = strenv(TAG)' $1
yq e -i '.monitor.containerImage.tag = strenv(TAG)' $1
yq e -i '.deployEnv = strenv(NAME)' $1
yq e -i '.secrets.localSettings.data.SEFARIA_DB = "sefaria-integration"'
yq e -i '.ingress.hosts[0].host = strenv(GIT_COMMIT)+".integration.sefaria.org"'
yq e -i '.secrets.localSettings.data.SEFARIA_DB = "sefaria-integration"' $1
yq e -i '.ingress.hosts[0].host = strenv(GIT_COMMIT)+".integration.sefaria.org"' $1
yq e -i '.localSettings.FRONT_END_URL = "https://"+strenv(GIT_COMMIT)+".integration.sefaria.org"' $1

helm upgrade -i $NAME ./helm-chart/sefaria-project --namespace $NAMESPACE -f $1 --debug --timeout=30m0s
Expand Down
3 changes: 2 additions & 1 deletion build/ci/integration-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ deployEnv:
previousServicesCount: "1"
restore:
enabled: false
cleanup: false
dynamicName: false
web:
containerImage:
Expand Down Expand Up @@ -36,7 +37,7 @@ ingress:
port: 80
secrets:
originTls:
ref: integration-wildcard-cert
ref: integration-wildcard-letsencrypt
nginx:
containerImage:
imageRegistry: us-east1-docker.pkg.dev/development-205018/containers/sefaria-asset-${BRANCH}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
-X
POST
--data-urlencode
'payload={"channel": "#'$CHANNEL'", "username": "Deployment Status", "text": "'$ENV' revision '$REVISION' has deployed version '$VERSION'", "icon_emoji": ":globe_with_meridians:"}'
'payload={"channel": "#'$CHANNEL'", "username": "Deployment Status", "text": "'$ENV' revision '$REVISION' has deployed version '$VERSION' using chart '$CHART_VERSION'", "icon_emoji": ":globe_with_meridians:"}'
$SLACK_URL
||
/bin/true
Expand All @@ -39,6 +39,8 @@ spec:
value: "{{`{{args.deployment}}`}}" # {{`...`}}
- name: VERSION
value: "{{`{{args.version}}`}}" # {{`...`}}
- name: CHART_VERSION
value: "{{`{{args.chartVersion}}`}}"
- name: SLACK_URL
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ spec:
envFrom:
- secretRef:
name: {{ .Values.secrets.localSettings.ref }}
optional: true
- configMapRef:
name: local-settings-{{ .Values.deployEnv }}
optional: true
- secretRef:
name: local-settings-secrets-{{ .Values.deployEnv }}
optional: true
Expand Down
2 changes: 2 additions & 0 deletions helm-chart/sefaria-project/templates/rollout/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
value: {{ .Values.deployEnv }}
- name: version
value: {{ .Values.web.containerImage.tag }}
- name: chartVersion
value: {{ .Chart.Version }}
{{- end }}
selector:
matchLabels:
Expand Down
2 changes: 1 addition & 1 deletion static/js/ConnectionsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class ConnectionsPanel extends Component {
<div className="topToolsButtons">
<ToolsButton en="About this Text" he="אודות הטקסט" image="about-text.svg" urlConnectionsMode="About" onClick={() => this.props.setConnectionsMode("About")} />
<ToolsButton en="Table of Contents" he="תוכן העניינים" image="text-navigation.svg" urlConnectionsMode="Navigation" onClick={() => this.props.setConnectionsMode("Navigation")} />
<ToolsButton en="Search in this Text" he="חפש בטקסט" image="compare.svg" urlConnectionsMode="SidebarSearch" onClick={() => this.props.setConnectionsMode("SidebarSearch")} />
<ToolsButton en="Search in this Text" he="חיפוש בטקסט" image="compare.svg" urlConnectionsMode="SidebarSearch" onClick={() => this.props.setConnectionsMode("SidebarSearch")} />
<ToolsButton en="Translations" he="תרגומים" image="translation.svg" urlConnectionsMode="Translations" onClick={() => this.props.setConnectionsMode("Translations")} count={resourcesButtonCounts.translations} />
</div>
}
Expand Down

0 comments on commit 7b583ca

Please sign in to comment.