Skip to content

Commit 657ebec

Browse files
authored
ci: merge main to release (#9769)
2 parents 845f68d + 9d7829d commit 657ebec

File tree

105 files changed

+3195
-2268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3195
-2268
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"dbaeumer.vscode-eslint",
2424
"eamodio.gitlens",
2525
"editorconfig.editorconfig",
26-
// Newer volar >=3.0.0 causes crashes in devcontainers
2726
2827
"mrmlnc.vscode-duplicate",
2928
"ms-azuretools.vscode-docker",
@@ -35,7 +34,8 @@
3534
"redhat.vscode-yaml",
3635
"spmeesseman.vscode-taskexplorer",
3736
"visualstudioexptteam.vscodeintellicode",
38-
"ms-python.pylint"
37+
"ms-python.pylint",
38+
"charliermarsh.ruff"
3939
],
4040
"settings": {
4141
"terminal.integrated.defaultProfile.linux": "zsh",

.github/workflows/build.yml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ on:
1616
- Skip
1717
- Staging Only
1818
- Staging + Prod
19-
sandbox:
20-
description: 'Deploy to Sandbox'
19+
dev:
20+
description: 'Deploy to Dev'
2121
default: true
2222
required: true
2323
type: boolean
24-
sandboxNoDbRefresh:
25-
description: 'Sandbox Disable Daily DB Refresh'
24+
devNoDbRefresh:
25+
description: 'Dev Disable Daily DB Refresh'
2626
default: false
2727
required: true
2828
type: boolean
@@ -278,8 +278,6 @@ jobs:
278278
tags: |
279279
ghcr.io/ietf-tools/datatracker:${{ env.PKG_VERSION }}
280280
${{ env.FEATURE_LATEST_TAG && format('ghcr.io/ietf-tools/datatracker:{0}-latest', env.FEATURE_LATEST_TAG) || null }}
281-
cache-from: type=gha
282-
cache-to: type=gha,mode=max
283281
284282
- name: Update CHANGELOG
285283
id: changelog
@@ -392,44 +390,45 @@ jobs:
392390
value: "Failed"
393391
394392
# -----------------------------------------------------------------
395-
# SANDBOX
393+
# DEV
396394
# -----------------------------------------------------------------
397-
sandbox:
398-
name: Deploy to Sandbox
399-
if: ${{ !failure() && !cancelled() && github.event.inputs.sandbox == 'true' }}
395+
dev:
396+
name: Deploy to Dev
397+
if: ${{ !failure() && !cancelled() && github.event.inputs.dev == 'true' }}
400398
needs: [prepare, release]
401-
runs-on: [self-hosted, dev-server]
399+
runs-on: ubuntu-latest
402400
environment:
403-
name: sandbox
401+
name: dev
404402
env:
405403
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}
406404

407405
steps:
408-
- uses: actions/checkout@v4
409-
410-
- name: Download a Release Artifact
411-
uses: actions/[email protected]
412-
with:
413-
name: release-${{ env.PKG_VERSION }}
414-
415-
- name: Deploy to containers
416-
env:
417-
DEBIAN_FRONTEND: noninteractive
418-
run: |
419-
echo "Reset production flags in settings.py..."
420-
sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = True/' -e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'development'/" ietf/settings.py
421-
echo "Install Deploy to Container CLI dependencies..."
422-
cd dev/deploy-to-container
423-
npm ci
424-
cd ../..
425-
echo "Start Deploy..."
426-
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }} --nodbrefresh ${{ github.event.inputs.sandboxNoDbRefresh }}
427-
428-
- name: Cleanup old docker resources
429-
env:
430-
DEBIAN_FRONTEND: noninteractive
431-
run: |
432-
docker image prune -a -f
406+
- uses: actions/checkout@v4
407+
with:
408+
ref: main
409+
410+
- name: Get Deploy Name
411+
env:
412+
DEBIAN_FRONTEND: noninteractive
413+
run: |
414+
echo "Install Get Deploy Name CLI dependencies..."
415+
cd dev/k8s-get-deploy-name
416+
npm ci
417+
echo "Get Deploy Name..."
418+
echo "DEPLOY_NAMESPACE=$(node cli.js --branch ${{ github.ref_name }})" >> "$GITHUB_ENV"
419+
420+
- name: Deploy to dev
421+
uses: the-actions-org/workflow-dispatch@v4
422+
with:
423+
workflow: deploy-dev.yml
424+
repo: ietf-tools/infra-k8s
425+
ref: main
426+
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
427+
inputs: '{ "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}", "namespace":"${{ env.DEPLOY_NAMESPACE }}", "disableDailyDbRefresh":${{ inputs.devNoDbRefresh }} }'
428+
wait-for-completion: true
429+
wait-for-completion-timeout: 30m
430+
wait-for-completion-interval: 30s
431+
display-workflow-run-url: false
433432

434433
# -----------------------------------------------------------------
435434
# STAGING
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*]
2+
indent_size = 2
3+
indent_style = space
4+
charset = utf-8
5+
trim_trailing_whitespace = false
6+
end_of_line = lf
7+
insert_final_newline = true

dev/k8s-get-deploy-name/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

dev/k8s-get-deploy-name/.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
audit = false
2+
fund = false
3+
save-exact = true

dev/k8s-get-deploy-name/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Datatracker Get Deploy Name
2+
3+
This tool process and slugify a git branch into an appropriate subdomain name.
4+
5+
## Usage
6+
7+
1. From the `dev/k8s-get-deploy-name` directory, install the dependencies:
8+
```sh
9+
npm install
10+
```
11+
2. Run the command: (replacing the `branch` argument)
12+
```sh
13+
node /cli.js --branch feat/fooBar-123
14+
```
15+
16+
The subdomain name will be output. It can then be used in a workflow as a namespace name and subdomain value.

dev/k8s-get-deploy-name/cli.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
3+
import yargs from 'yargs/yargs'
4+
import { hideBin } from 'yargs/helpers'
5+
import slugify from 'slugify'
6+
7+
const argv = yargs(hideBin(process.argv)).argv
8+
9+
let branch = argv.branch
10+
if (!branch) {
11+
throw new Error('Missing --branch argument!')
12+
}
13+
if (branch.indexOf('/') >= 0) {
14+
branch = branch.split('/').slice(1).join('-')
15+
}
16+
branch = slugify(branch, { lower: true, strict: true })
17+
if (branch.length < 1) {
18+
throw new Error('Branch name is empty!')
19+
}
20+
process.stdout.write(`dt-${branch}`)
21+
22+
process.exit(0)

0 commit comments

Comments
 (0)