Skip to content
Draft
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
10 changes: 0 additions & 10 deletions .github/workflows/_deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ jobs:
with:
fetch-depth: 0

- name: Checkout werf repo
uses: actions/checkout@v6
with:
repository: werf/werf
path: werf
fetch-depth: 0

- name: Inject trdl_channels.yaml
run: |
cp werf/trdl_channels.yaml .helm/trdl_channels.yaml

- name: Install werf
uses: werf/actions/install@v2
Expand Down
39 changes: 25 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
name: Deploy

on:
push:
branches:
- chore/docs-major-routing
pull_request:
types: [labeled, synchronize]
workflow_dispatch:
inputs:
targetEnvironment:
description: "Target environment in dev cluster"
required: true
default: test
type: choice
options:
- test
- stage

env:
WERF_ENV: "production"
Expand All @@ -15,30 +27,27 @@ env:
jobs:
converge:
name: Deploy
if: contains(github.event.pull_request.labels.*.name, 'test website') || contains(github.event.pull_request.labels.*.name, 'stage website')
if: >-
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
(contains(github.event.pull_request.labels.*.name, 'test website') ||
contains(github.event.pull_request.labels.*.name, 'stage website')))
runs-on: prod-github-runner-0
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Checkout werf repo
uses: actions/checkout@v6
with:
repository: werf/werf
path: werf
fetch-depth: 0

- name: Inject trdl_channels.yaml
run: |
cp werf/trdl_channels.yaml .helm/trdl_channels.yaml

- name: Install werf
uses: werf/actions/install@v2

- name: Deploy to test
if: contains(github.event.pull_request.labels.*.name, 'test website')
if: >-
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.targetEnvironment == 'test') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'test website'))
run: |
. $(werf ci-env github --as-file)
werf converge
Expand All @@ -51,7 +60,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to stage
if: contains(github.event.pull_request.labels.*.name, 'stage website')
if: >-
(github.event_name == 'workflow_dispatch' && github.event.inputs.targetEnvironment == 'stage') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'stage website'))
run: |
. $(werf ci-env github --as-file)
werf converge
Expand Down
21 changes: 2 additions & 19 deletions .helm/templates/12-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
env:
- name: ACTIVE_RELEASE
value: {{ .Values.global.active_release | quote }}
- name: SUPPORTED_DOCS_MAJOR_VERSIONS
value: {{ join "," (pluck .Values.werf.env .Values.docsMajorRoots | first | default .Values.docsMajorRoots._default) | quote }}
- name: LOG_LEVEL
value: "info"
{{- if ne .Values.werf.env "production" }}
Expand All @@ -53,13 +55,6 @@ spec:
httpGet:
path: /health
port: 8080
volumeMounts:
- name: trdl-data
mountPath: /app/trdl
volumes:
- name: trdl-data
configMap:
name: trdl-data
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -96,15 +91,3 @@ spec:
selector:
matchLabels:
service: backend
---
apiVersion: v1
kind: ConfigMap
metadata:
name: trdl-data
data:
trdl_channels.yaml: |
{{- if eq .Values.werf.env "production" }}
{{ .Files.Get "trdl_channels.yaml" | indent 4 }}
{{- else }}
{{ .Files.Get "trdl_channels-dev.yaml" | indent 4 }}
{{- end }}
424 changes: 217 additions & 207 deletions .helm/templates/_rewrites.tpl

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
global:
targetCluster: ""

docsMajorRoots:
_default:
- v2
- v1

imagePullSecrets:
- github-werfio

Expand Down
18 changes: 17 additions & 1 deletion .werf/nginx-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,24 @@ http {
proxy_pass http://website-$lang;
}

location = /docs {
return 302 /docs/v2/;
}

location ~ ^/docs/latest/(?<tail>.*)$ {
return 302 /docs/v2/$tail;
}

location ~ ^/docs/(?<major>v2)-(?:alpha|beta|ea|stable|rock-solid)(?<suffix>/.*)?$ {
return 302 /docs/$major$suffix;
}

location ~ ^/docs/(?<major>v[12])(?:\.[^/]+)+(?<suffix>/.*)?$ {
return 302 /docs/$major$suffix;
}

location /docs/ {
rewrite ^/docs/(?<ver>v\d+(?:\.\d+(?:\.\d+(?:[^/]+)?)?)?|latest)/(?<tail>.*) /$tail break;
rewrite ^/docs/(?<ver>v\d+|pr-\d+)/(?<tail>.*) /$tail break;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
10 changes: 1 addition & 9 deletions _includes/_common/channel-menu-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@
</a>
<div class="submenu-container">
<ul class="submenu">
{{- $prevVersion := "" }}
{{- range (slice .VersionItems 1) }}
<li class="submenu-item">
<a data-proofer-ignore class="submenu-item-link" href="/docs/{{ .VersionURL }}{{ $CurrentPageURLRelative }}">
{{- if eq .Version "latest" }}
<span class="submenu-item-channel">latest</span>
{{- else }}
<span class="submenu-item-channel"> {{ .Group }}-{{ .Channel }}</span>
<span class="submenu-item-dot{{ if eq $prevVersion .Version }} submenu-item-dot_special{{ end }}"></span>
<span class="submenu-item-release">{{ .Version }}</span>
{{- end }}
<span class="submenu-item-channel">{{ .Version }}</span>
</a>
</li>
{{ $prevVersion = .Version }}
{{- end }}
</ul>
</div>
Expand Down
12 changes: 1 addition & 11 deletions _includes/_common/channel-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
{{ $CurrentPageURLRelative := .CurrentPageURLRelative }}
<div class="submenu-container">
<ul class="submenu">
{{- $prevVersion := "" }}
{{- range (slice .VersionItems 1) }}
<li class="submenu-item">
<a data-proofer-ignore class="submenu-item-link" href="/docs/{{ .VersionURL }}{{ $CurrentPageURLRelative }}">
{{- if eq .Version "latest" }}
<span class="submenu-item-channel">latest</span>
<span class="submenu-item-dot{{ if eq $prevVersion .Version }} submenu-item-dot_special{{ end }}"></span>
<span class="submenu-item-release">main</span>
{{- else }}
<span class="submenu-item-channel"> {{ .Group }}-{{ .Channel }}</span>
<span class="submenu-item-dot{{ if eq $prevVersion .Version }} submenu-item-dot_special{{ end }}"></span>
<span class="submenu-item-release">{{ .Version }}</span>
{{- end }}
<span class="submenu-item-channel">{{ .Version }}</span>
</a>
</li>
{{ $prevVersion = .Version }}
{{- end }}
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/_common/group-menu-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
{{ $CurrentPageURL := .CurrentPageURL }}
{{ $CurrentPageURLRelative := .CurrentPageURLRelative }}
{{- $first := index .VersionItems 0 }}
<li class="breadcrumbs__item">{{- if $first.Group }}v{{- $first.Group }}{{- else }}{{ $first.Version }}{{- end }}</li>
<li class="breadcrumbs__item">{{ $first.Version }}</li>
{% endraw %}
8 changes: 3 additions & 5 deletions _includes/_common/group-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
{{ $CurrentPageURLRelative := .CurrentPageURLRelative }}
<li id="group-versions-menu" class="breadcrumbs__item breadcrumbs__item_parent submenu-parent">
{{- $first := index .VersionItems 0 }}
<a data-proofer-ignore href="#">{{- if $first.Group }}v{{- $first.Group }}{{- else }}{{ $first.Version }}{{- end }}</a>
<a data-proofer-ignore href="#">{{ $first.Version }}</a>
<div class="submenu-container">
<ul class="submenu">
{{- $prevVersion := "" }}
{{- range (slice .VersionItems 1) }}
<li class="submenu-item">
<a data-proofer-ignore class="submenu-item-link" href="/docs/v{{ .Group }}{{ $CurrentPageURLRelative }}">
v{{ .Group }}
<a data-proofer-ignore class="submenu-item-link" href="/docs/{{ .VersionURL }}{{ $CurrentPageURLRelative }}">
{{ .Version }}
</a>
</li>
{{ $prevVersion = .Version }}
{{- end }}
</ul>
</div>
Expand Down
12 changes: 1 addition & 11 deletions _includes/_common/version-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,16 @@
<li id="doc-versions-menu" class="submenu-parent" style="display: none">
{{- $first := index .VersionItems 0 }}
<a data-proofer-ignore href="#">
{{- if $first.Group }}
{{- $first.Group }}-{{ $first.Channel }}
<span class="menu-item-dot"></span>
<span class="menu-item-extra">{{ $first.Version }}</span>
{{- else }}
{{ $first.Version }}
{{- end }}
</a>
<div class="submenu-container">
<ul class="submenu">
{{- $prevVersion := "" }}
{{- range (slice .VersionItems 1) }}
<li class="submenu-item">
<a data-proofer-ignore class="submenu-item-link" href="/docs/{{ .VersionURL }}{{ $CurrentPageURLRelative }}">
<span class="submenu-item-channel"> {{ .Group }}-{{ .Channel }}</span>
<span class="submenu-item-dot{{ if eq $prevVersion .Version }} submenu-item-dot_special{{ end }}"></span>
<span class="submenu-item-release">{{ .Version }}</span>
<span class="submenu-item-channel">{{ .Version }}</span>
</a>
</li>
{{ $prevVersion = .Version }}
{{- end }}
</ul>
</div>
Expand Down
10 changes: 3 additions & 7 deletions assets/js/customscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,21 +466,17 @@ $(document).ready(function () {
});

function getDocGroupFromURL() {
let result = window.location.pathname.match(/^\/docs\/(v\d+\.\d+)/);
let result = window.location.pathname.match(/^\/docs\/(latest|v\d+)(?:[\.-][^/]+)?(?:\/|$)/);
if ( result && result[1] ) {
return result[1];
}
return null;
}

function getDocVersionFromURL() {
let result = window.location.pathname.match(/\/docs\/(v\d+\.\d+([^/]+)?)\/.*/);
let result = window.location.pathname.match(/^\/docs\/(latest|v\d+(?:[\.-][^/]+)*)\/.*/);
if ( result ) {
if ( result.length > 2 && result[2] ) {
return result[1].replace('-plus-','+');
} else {
return "main";
}
return result[1].replace('-plus-','+');
}
return null;
}
Expand Down
Loading
Loading