Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Weblate 2025-01-08 06:46:02 +00:00
commit 41a0a5cf12
8 changed files with 110 additions and 96 deletions

View File

@ -5,8 +5,7 @@
stages: stages:
- lint - lint
- test - test
- prod-deployment - build-and-deploy
- dev-deployment
- release - release
variables: variables:

View File

@ -1,81 +1,42 @@
# yamllint disable rule:line-length # yamllint disable rule:line-length
--- ---
docker-build-dev: docker-build:
image: docker:latest image: docker:latest
services: services:
- name: docker:dind - name: docker:dind
stage: dev-deployment stage: build-and-deploy
tags: tags:
- docker_priv - docker_priv
rules:
- if: $CI_COMMIT_BRANCH == 'dev'
environment:
name: development
before_script:
- |
apk --no-cache add jq
MAJOR=$(cat app/config/version.json | jq '.major' )
MINOR=$(cat app/config/version.json | jq '.minor' )
SUB=$(cat app/config/version.json | jq '.sub' )
- |
apk --no-cache add curl
latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p')
echo "Using buildx version $latest_tag"
curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64"
chmod a+x docker-buildx
mkdir -p ~/.docker/cli-plugins
mv docker-buildx ~/.docker/cli-plugins/docker-buildx
docker version
- docker run --rm --privileged aptman/qus -- -r
- docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64
- echo $CI_JOB_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- echo $DOCKERHUB_TOKEN | docker login -u "$DOCKERHUB_USER" --password-stdin $DOCKERHUB_REGISTRY
script:
- |
tag=":$CI_COMMIT_REF_SLUG"
VERSION="${MAJOR}.${MINOR}.${SUB}"
- |
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
echo "Crafty Version: $VERSION"
- docker context create tls-environment
- docker buildx create --name zedBuilder --use tls-environment
- docker buildx build
--cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}"
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")"
--build-arg "BUILD_REF=${CI_COMMIT_SHA}"
--build-arg "CRAFTY_VER=${VERSION}"
--provenance false
--tag "$CI_REGISTRY_IMAGE${tag}"
--tag "arcadiatechnology/crafty-4${tag}"
--platform linux/arm64/v8,linux/amd64
--push .
after_script:
- |
docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance."
docker context rm tls-environment || true
echo "Please review multi-arch manifests are present:"
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
docker-build-prod:
image: docker:latest
services:
- name: docker:dind
stage: prod-deployment
tags:
- docker_priv
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Development branch
- if: $CI_COMMIT_BRANCH == 'dev'
variables:
ENVIRONMENT_NAME: "development"
DOCKER_TAGS: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG arcadiatechnology/crafty-4:$CI_COMMIT_REF_SLUG"
# Production branch (main) when not scheduled
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"
variables:
ENVIRONMENT_NAME: "production"
# We'll set the version in the script and append stable tags
DOCKER_TAGS: "" # We'll determine in script
# Scheduled nightly builds on main
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
ENVIRONMENT_NAME: "nightly"
DOCKER_TAGS: "$CI_REGISTRY_IMAGE:nightly arcadiatechnology/crafty-4:nightly"
environment: environment:
name: production name: $ENVIRONMENT_NAME
before_script: before_script:
- | - |
apk --no-cache add jq apk --no-cache add jq curl
MAJOR=$(cat app/config/version.json | jq '.major' ) MAJOR=$(cat app/config/version.json | jq -r '.major')
MINOR=$(cat app/config/version.json | jq '.minor' ) MINOR=$(cat app/config/version.json | jq -r '.minor')
SUB=$(cat app/config/version.json | jq '.sub' ) SUB=$(cat app/config/version.json | jq -r '.sub')
VERSION="${MAJOR}.${MINOR}.${SUB}"
- | - |
apk --no-cache add curl
latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p') latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p')
echo "Using buildx version $latest_tag" echo "Using buildx version $latest_tag"
curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64" curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64"
@ -87,30 +48,61 @@ docker-build-prod:
- docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64
- echo $CI_JOB_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - echo $CI_JOB_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- echo $DOCKERHUB_TOKEN | docker login -u "$DOCKERHUB_USER" --password-stdin $DOCKERHUB_REGISTRY - echo $DOCKERHUB_TOKEN | docker login -u "$DOCKERHUB_USER" --password-stdin $DOCKERHUB_REGISTRY
- docker context create tls-environment-$CI_JOB_ID
- docker buildx create --name zedBuilder-$CI_JOB_ID --use tls-environment-$CI_JOB_ID
script: script:
- echo "Running on branch '$CI_COMMIT_BRANCH', environment- $ENVIRONMENT_NAME"
- echo "Crafty Version- $VERSION"
# If DOCKER_TAGS is empty (production default branch and not schedule), we set stable tags:
# This scenario adds both VERSION and 'latest' tags.
- | - |
VERSION="${MAJOR}.${MINOR}.${SUB}" if [ "$ENVIRONMENT_NAME" = "production" ] && [ -z "$DOCKER_TAGS" ]; then
DOCKER_TAGS="$CI_REGISTRY_IMAGE:${VERSION} \
$CI_REGISTRY_IMAGE:latest \
arcadiatechnology/crafty-4:${VERSION} \
arcadiatechnology/crafty-4:latest"
fi
- echo "Using the following tags- $DOCKER_TAGS"
# Prepare build command
# We break DOCKER_TAGS into separate --tag arguments
- TARGS=""
- for t in $DOCKER_TAGS; do TARGS="$TARGS --tag $t"; done
- echo "Tag arguments- $TARGS"
# Conditional build command: omit cache if schedule
- | - |
echo "Running on branch '$CI_COMMIT_BRANCH'" if [ "$CI_PIPELINE_SOURCE" = "schedule" ]; then
echo "Crafty Version: $VERSION" echo "Omitting cache for nightly build."
- docker context create tls-environment docker buildx build \
- docker buildx create --name zedBuilder --use tls-environment --build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" \
- docker buildx build --build-arg "BUILD_REF=${CI_COMMIT_SHA}" \
--cache-from type=registry,ref="$CI_REGISTRY_IMAGE:latest" --build-arg "CRAFTY_VER=${VERSION}" \
--build-arg BUILDKIT_INLINE_CACHE=1 --provenance false \
--build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" $TARGS \
--build-arg "BUILD_REF=${CI_COMMIT_SHA}" --platform linux/arm64/v8,linux/amd64 \
--build-arg "CRAFTY_VER=${VERSION}" --push .
--provenance false else
--tag "$CI_REGISTRY_IMAGE:$VERSION" echo "Using cache for build."
--tag "$CI_REGISTRY_IMAGE:latest" docker buildx build \
--tag "arcadiatechnology/crafty-4:$VERSION" --cache-from type=registry,ref="$CI_REGISTRY_IMAGE:dev" \
--tag "arcadiatechnology/crafty-4:latest" --build-arg BUILDKIT_INLINE_CACHE=1 \
--platform linux/arm64/v8,linux/amd64 --build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" \
--push . --build-arg "BUILD_REF=${CI_COMMIT_SHA}" \
--build-arg "CRAFTY_VER=${VERSION}" \
--provenance false \
$TARGS \
--platform linux/arm64/v8,linux/amd64 \
--push .
fi
after_script: after_script:
- | - docker buildx rm zedBuilder-$CI_JOB_ID && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance."
docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance." - docker context rm tls-environment-$CI_JOB_ID || true
docker context rm tls-environment || true - echo "Please review multi-arch manifests are present:"
echo "Please review multi-arch manifests are present:" - if [ "$ENVIRONMENT_NAME" = "development" ]; then docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"; fi
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}" - if [ "$ENVIRONMENT_NAME" = "production" ] && [ -n "$VERSION" ]; then docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$VERSION"; fi
- if [ "$ENVIRONMENT_NAME" = "nightly" ]; then docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:nightly"; fi

View File

@ -9,6 +9,8 @@ yamllint:
rules: rules:
- if: "$CODE_QUALITY_DISABLED" - if: "$CODE_QUALITY_DISABLED"
when: never when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
script: script:
- yamllint . - yamllint .
@ -22,6 +24,8 @@ jsonlint:
rules: rules:
- if: "$CODE_QUALITY_DISABLED" - if: "$CODE_QUALITY_DISABLED"
when: never when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
script: script:
- | - |
@ -37,6 +41,8 @@ black:
rules: rules:
- if: "$CODE_QUALITY_DISABLED" - if: "$CODE_QUALITY_DISABLED"
when: never when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
script: script:
- black --check --verbose -- . - black --check --verbose -- .
@ -50,6 +56,8 @@ pylint:
rules: rules:
- if: "$CODE_QUALITY_DISABLED" - if: "$CODE_QUALITY_DISABLED"
when: never when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
before_script: before_script:
- apk update - apk update
@ -75,6 +83,8 @@ sonarcloud-check:
when: never when: never
- if: "$CODE_QUALITY_DISABLED" - if: "$CODE_QUALITY_DISABLED"
when: never when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
variables: variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
@ -94,6 +104,8 @@ sonarcloud-check:
# rules: # rules:
# - if: "$CODE_QUALITY_DISABLED" # - if: "$CODE_QUALITY_DISABLED"
# when: never # when: never
# - if: $CI_PIPELINE_SOURCE == "schedule"
# when: never
# - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH" # - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
# allow_failure: true # allow_failure: true
# before_script: # before_script:

View File

@ -4,6 +4,8 @@ release:
stage: release stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
needs: needs:
- job: win-prod-build - job: win-prod-build

View File

@ -1,13 +1,15 @@
# yamllint disable rule:line-length # yamllint disable rule:line-length
--- ---
win-dev-build: win-dev-build:
stage: dev-deployment stage: build-and-deploy
tags: tags:
- win64 - win64
cache: cache:
paths: paths:
- .venv/ - .venv/
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_BRANCH == 'dev'" - if: "$CI_COMMIT_BRANCH == 'dev'"
environment: environment:
name: development name: development
@ -48,13 +50,15 @@ win-dev-build:
- app\classes\**\* - app\classes\**\*
win-prod-build: win-prod-build:
stage: prod-deployment stage: build-and-deploy
tags: tags:
- win64 - win64
cache: cache:
paths: paths:
- .venv/ - .venv/
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
environment: environment:

View File

@ -4,13 +4,18 @@
TBD TBD
### Refactor ### Refactor
- Refactor and standardize all JSON validator errors returning human readable translations ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/786)) - Refactor and standardize all JSON validator errors returning human readable translations ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/786))
- Improve docker-build CI/CD, supporting nightly builds ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/813))
### Bug fixes ### Bug fixes
- Bump requests to resolve yank for CVE-2024-35195 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/808)) - Bump requests to resolve yank for CVE-2024-35195 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/808))
### Tweaks ### Tweaks
TBD - Bump Docker base image `22.04` -> `24.04` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/812))
- Bump python pip `2.0.3` -> `24.3.1` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/812))
- Bump python setuptools `50.3.2` -> `75.6.0` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/812))
- Bump tornado for CVE-2024-52804 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/814))
### Lang ### Lang
- Weblate Translation Platform Integration - Weblate Translation Platform Integration
- Remove incomplete labels from translation files to better support new translation workflow ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/810)) - Remove incomplete labels from translation files to better support new translation workflow ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/810))
- New langs added `ja_JP`, `ko_KR` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/811))
<br><br> <br><br>
## --- [4.4.4] - 2024/10/03 ## --- [4.4.4] - 2024/10/03

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04 FROM ubuntu:24.04
ENV DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND="noninteractive"
@ -36,7 +36,7 @@ WORKDIR /crafty
COPY --chown=crafty:root requirements.txt ./ COPY --chown=crafty:root requirements.txt ./
RUN python3 -m venv ./.venv \ RUN python3 -m venv ./.venv \
&& . .venv/bin/activate \ && . .venv/bin/activate \
&& pip3 install --no-cache-dir --upgrade setuptools==50.3.2 pip==22.0.3 \ && pip3 install --no-cache-dir --upgrade setuptools==75.6.0 pip==24.3.1 \
&& pip3 install --no-cache-dir -r requirements.txt \ && pip3 install --no-cache-dir -r requirements.txt \
&& deactivate && deactivate
USER root USER root

View File

@ -15,7 +15,7 @@ pyjwt==2.8.0
PyYAML==6.0.1 PyYAML==6.0.1
requests==2.32.3 requests==2.32.3
termcolor==1.1 termcolor==1.1
tornado==6.4.1 tornado==6.4.2
tzlocal==5.1 tzlocal==5.1
jsonschema==4.19.1 jsonschema==4.19.1
orjson==3.9.15 orjson==3.9.15