Skip to content

Commit

Permalink
ci: merge main to release (pull request #7034 from ietf-tools/main)
Browse files Browse the repository at this point in the history
ci: merge main to release
  • Loading branch information
rjsparks committed Feb 7, 2024
2 parents d31605e + d42215b commit ac4062f
Show file tree
Hide file tree
Showing 89 changed files with 2,740 additions and 748 deletions.
57 changes: 50 additions & 7 deletions .github/workflows/build.yml
Expand Up @@ -123,6 +123,9 @@ jobs:
if: ${{ !failure() && !cancelled() }}
needs: [tests, prepare]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
SHOULD_DEPLOY: ${{needs.prepare.outputs.should_deploy}}
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}
Expand Down Expand Up @@ -154,13 +157,17 @@ jobs:
- name: Make Release Build
env:
DEBIAN_FRONTEND: noninteractive
BROWSERSLIST_IGNORE_OLD_DATA: 1
run: |
echo "PKG_VERSION: $PKG_VERSION"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Running build script..."
chmod +x ./dev/deploy/build.sh
sh ./dev/deploy/build.sh
echo "Running frontend build script..."
echo "Compiling native node packages..."
yarn rebuild
echo "Packaging static assets..."
yarn build --base=https://static.ietf.org/dt/$PKG_VERSION/
yarn legacy:build
echo "Setting version $PKG_VERSION..."
sed -i -r -e "s|^__version__ += '.*'$|__version__ = '$PKG_VERSION'|" ietf/__init__.py
sed -i -r -e "s|^__release_hash__ += '.*'$|__release_hash__ = '$GITHUB_SHA'|" ietf/__init__.py
Expand All @@ -178,7 +185,7 @@ jobs:
run: |
echo "Build release tarball..."
mkdir -p /home/runner/work/release
tar -czf /home/runner/work/release/release.tar.gz -X dev/deploy/exclude-patterns.txt .
tar -czf /home/runner/work/release/release.tar.gz -X dev/build/exclude-patterns.txt .
- name: Collect + Push Statics
env:
Expand All @@ -189,10 +196,46 @@ jobs:
AWS_ENDPOINT_URL: ${{ secrets.CF_R2_ENDPOINT }}
run: |
echo "Collecting statics..."
docker run --rm --name collectstatics -v $(pwd):/workspace ghcr.io/ietf-tools/datatracker-app-base:latest sh dev/deploy/collectstatics.sh
docker run --rm --name collectstatics -v $(pwd):/workspace ghcr.io/ietf-tools/datatracker-app-base:latest sh dev/build/collectstatics.sh
echo "Pushing statics..."
cd static
aws s3 sync . s3://static/dt/$PKG_VERSION --only-show-errors
- name: Augment dockerignore for docker image build
env:
DEBIAN_FRONTEND: noninteractive
run: |
cat >> .dockerignore <<EOL
.devcontainer
.github
.vscode
helm
playwright
svn-history
docker-compose.yml
EOL
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Release Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: dev/build/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/ietf-tools/datatracker:${{ env.PKG_VERSION }}

- name: Update CHANGELOG
id: changelog
Expand Down Expand Up @@ -269,7 +312,7 @@ jobs:
steps:
- name: Notify on Slack (Success)
if: ${{ !contains(join(needs.*.result, ','), 'failure') }}
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: ${{ secrets.SLACK_GH_BUILDS_CHANNEL_ID }}
payload: |
Expand All @@ -292,7 +335,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_GH_BOT }}
- name: Notify on Slack (Failure)
if: ${{ contains(join(needs.*.result, ','), 'failure') }}
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: ${{ secrets.SLACK_GH_BUILDS_CHANNEL_ID }}
payload: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Expand Up @@ -17,6 +17,6 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
with:
vulnerability-check: false
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -59,7 +59,7 @@ jobs:
path: geckodriver.log

- name: Upload Coverage Results to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5
with:
files: coverage.xml

Expand Down
198 changes: 94 additions & 104 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions bin/hourly
Expand Up @@ -45,6 +45,7 @@ ID=/a/ietfdata/doc/draft/repository
DERIVED=/a/ietfdata/derived
DOWNLOAD=/a/www/www6s/download

## Start of script refactored into idindex_update_task() ===
export TMPDIR=/a/tmp

TMPFILE1=`mktemp` || exit 1
Expand Down Expand Up @@ -85,6 +86,8 @@ mv $TMPFILE9 $DERIVED/1id-index.txt
mv $TMPFILEA $DERIVED/1id-abstracts.txt
mv $TMPFILEB $DERIVED/all_id2.txt

## End of script refactored into idindex_update_task() ===

$DTDIR/ietf/manage.py generate_idnits2_rfc_status
$DTDIR/ietf/manage.py generate_idnits2_rfcs_obsoleted

Expand Down
17 changes: 17 additions & 0 deletions dev/build/Dockerfile
@@ -0,0 +1,17 @@
FROM ghcr.io/ietf-tools/datatracker-app-base:latest
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"

ENV DEBIAN_FRONTEND=noninteractive

COPY . .
COPY ./dev/build/start.sh ./start.sh
RUN pip3 --disable-pip-version-check --no-cache-dir install -r requirements.txt
RUN chmod +x start.sh && \
chmod +x docker/scripts/app-create-dirs.sh && \
sh ./docker/scripts/app-create-dirs.sh

VOLUME [ "/assets" ]

EXPOSE 8000

CMD ["./start.sh"]
13 changes: 13 additions & 0 deletions dev/build/collectstatics.sh
@@ -0,0 +1,13 @@
#!/bin/bash

# Copy temp local settings
cp dev/build/settings_local_collectstatics.py ietf/settings_local.py

# Install Python dependencies
pip --disable-pip-version-check --no-cache-dir install -r requirements.txt

# Collect statics
ietf/manage.py collectstatic

# Delete temp local settings
rm ietf/settings_local.py
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions dev/build/start.sh
@@ -0,0 +1,10 @@
#!/bin/bash

echo "Running Datatracker checks..."
./ietf/manage.py check

echo "Running Datatracker migrations..."
./ietf/manage.py migrate --settings=settings_local

echo "Starting Datatracker..."
./ietf/manage.py runserver 0.0.0.0:8000 --settings=settings_local
14 changes: 7 additions & 7 deletions dev/coverage-action/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/coverage-action/package.json
Expand Up @@ -19,6 +19,6 @@
"eslint-plugin-import": "2.29.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1",
"npm-check-updates": "16.14.12"
"npm-check-updates": "16.14.14"
}
}
11 changes: 0 additions & 11 deletions dev/deploy/build.sh

This file was deleted.

9 changes: 0 additions & 9 deletions dev/deploy/collectstatics.sh

This file was deleted.

23 changes: 23 additions & 0 deletions helm/.helmignore
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
23 changes: 23 additions & 0 deletions helm/Chart.yaml
@@ -0,0 +1,23 @@
apiVersion: v2
name: datatracker
description: The day-to-day front-end to the IETF database for people who work on IETF standards.
home: https://datatracker.ietf.org
sources:
- https://github.com/ietf-tools/datatracker
maintainers:
- name: IETF Tools Team
email: tools-discuss@ietf.org
url: https://github.com/ietf-tools

type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
62 changes: 62 additions & 0 deletions helm/templates/_helpers.tpl
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "datatracker.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "datatracker.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "datatracker.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "datatracker.labels" -}}
helm.sh/chart: {{ include "datatracker.chart" . }}
{{ include "datatracker.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "datatracker.selectorLabels" -}}
app.kubernetes.io/name: {{ include "datatracker.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "datatracker.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "datatracker.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

0 comments on commit ac4062f

Please sign in to comment.