From 7d7ed2e9d3f07d994e91308874c481d57941aa35 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:07:46 +0100 Subject: [PATCH] Ignore old GitLab jobs --- .gitlab-ci.yml | 11 ----- gitlab/base.sh | 100 ----------------------------------------- gitlab/ci/template.yml | 64 -------------------------- gitlab/ci/unit.yml | 42 ----------------- gitlab/ci_settings.sh | 55 ----------------------- gitlab/default-nginx | 12 ----- 6 files changed, 284 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100755 gitlab/base.sh delete mode 100644 gitlab/ci/template.yml delete mode 100644 gitlab/ci/unit.yml delete mode 100755 gitlab/ci_settings.sh delete mode 100644 gitlab/default-nginx diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 9f73622022..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,11 +0,0 @@ -include: - - '/gitlab/ci/unit.yml' - - '/gitlab/ci/template.yml' - -stages: - - test - - unit - - style - - ci_checks - -image: domjudge/gitlabci:24.04 diff --git a/gitlab/base.sh b/gitlab/base.sh deleted file mode 100755 index 7300b8e865..0000000000 --- a/gitlab/base.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash - -. gitlab/ci_settings.sh - -# If this script is called from unit.sh, we use the test environment -export APP_ENV="${1:-prod}" - -# In the test environment, we need to use a different database -[ "$APP_ENV" = "prod" ] && DATABASE_NAME=domjudge || DATABASE_NAME=domjudge_test - -lsb_release -a - -# FIXME: This chicken-egg problem is annoying but let us bootstrap for now. -echo "CREATE DATABASE IF NOT EXISTS \`${DATABASE_NAME}\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" | mysql -echo "CREATE USER 'domjudge'@'%' IDENTIFIED BY 'domjudge';" | mysql -echo "GRANT SELECT, INSERT, UPDATE, DELETE ON \`${DATABASE_NAME}\`.* TO 'domjudge'@'%';" | mysql - -# Increase max_allowed_packet for following connections. -echo "SET GLOBAL max_allowed_packet = 100*1024*1024;" | mysql - -# Test that SQL upgrade scripts also work with this setting -if [ -n "${MYSQL_REQUIRE_PRIMARY_KEY:-}" ]; then - echo 'SET GLOBAL sql_require_primary_key = 1;' | mysql -fi - -# Generate a dbpasswords file -# Note that this does not use ${DATABASE_NAME} since Symfony adds the _test postfix itself -echo "unused:sqlserver:domjudge:domjudge:domjudge:3306" > etc/dbpasswords.secret - -# Generate APP_SECRET for symfony -# shellcheck disable=SC2164 -( cd etc ; ./gensymfonysecret > symfony_app.secret ) - -cat > webapp/config/static.yaml <> ~www-data/.netrc -sudo -Eu www-data bin/dj_setup_database -uroot -p${MYSQL_ROOT_PASSWORD} bare-install - -# shellcheck disable=SC2154 -if [ -n "${integration:-}" ]; then - # Make sure admin has a team associated to insert submissions as well. - echo "UPDATE user SET teamid=1 WHERE userid=1;" | mysql domjudge -elif [ -n "${unit:-}" ]; then - # Make sure admin has no team associated so we will not insert submissions during unit tests. - echo "UPDATE user SET teamid=null WHERE userid=1;" | mysql domjudge_test -fi - -sudo -Eu www-data bin/dj_setup_database -uroot -p${MYSQL_ROOT_PASSWORD} install-examples diff --git a/gitlab/ci/template.yml b/gitlab/ci/template.yml deleted file mode 100644 index e810df854c..0000000000 --- a/gitlab/ci/template.yml +++ /dev/null @@ -1,64 +0,0 @@ -# This placeholder job tries to start as soon as possible -.clean_ordering: - needs: [] - retry: - max: 2 #Max is 2, set when gitlab is flacky - when: - - always - script: - - /bin/true - -.tiny_job: - extends: [.clean_ordering] - timeout: 4m - -.short_job: - extends: [.clean_ordering] - timeout: 7m - -.normal_job: - extends: [.clean_ordering] - timeout: 20m - -.long_job: - extends: [.clean_ordering] - timeout: 30m - -.cached_vendor: - extends: [.clean_ordering] - cache: - key: webappvendor-20240623 - paths: - - webapp/vendor/ - -.mysql_job: - script: - - /bin/true - services: - - name: mysql - alias: sqlserver - -.mariadb_job: - script: - - /bin/true - services: - - name: mariadb - alias: sqlserver - -.phpsupported_job: - script: - - /bin/true - parallel: - matrix: - - PHPVERSION: ["8.1","8.2","8.3", "8.4"] - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0","1"] - -.phpsupported_job_pr: - script: - - /bin/true - parallel: - matrix: - - PHPVERSION: ["8.3"] - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0"] diff --git a/gitlab/ci/unit.yml b/gitlab/ci/unit.yml deleted file mode 100644 index 5bf7aab8c7..0000000000 --- a/gitlab/ci/unit.yml +++ /dev/null @@ -1,42 +0,0 @@ -.unit_job: - extends: [.normal_job,.cached_vendor] - stage: unit - # Disabled for now as it drastically speeds up running unit tests and we don't use it yet - # before_script: - # - apt-get update -yqq - # - apt-get install php-xdebug -yqq - variables: - MYSQL_ROOT_PASSWORD: password - MARIADB_PORT_3306_TCP_ADDR: sqlserver - script: - - set -eux - - if [ -z ${PHPVERSION+x} ]; then export PHPVERSION=8.1; fi - - if [ -z ${TEST+x} ]; then export TEST="UNIT"; fi - - if [ "$TEST" = "UNIT" ] && [ "$CRAWL_SHADOW_MODE" != "0" ]; then exit 0; fi - - if [ "$TEST" = "E2E" ] && [ "$CRAWL_SHADOW_MODE" != "0" ] && [ "$CI_COMMIT_BRANCH" != "main" ]; then exit 0; fi - - export CRAWL_SHADOW_MODE - - ./gitlab/unit-tests.sh $PHPVERSION $TEST - artifacts: - when: always - paths: - - unit-tests.xml - - coverage-html - - deprecation.txt - - duration - - gitlabartifacts - reports: - junit: - - unit-tests.xml - -run unit tests: - extends: [.mariadb_job,.phpsupported_job,.unit_job] - -run unit tests (PR): - extends: [.mariadb_job,.phpsupported_job_pr,.unit_job] - -run unit tests (MySQL): - extends: [.mysql_job,.unit_job] - parallel: - matrix: - - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0"] diff --git a/gitlab/ci_settings.sh b/gitlab/ci_settings.sh deleted file mode 100755 index dfea8a1925..0000000000 --- a/gitlab/ci_settings.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Fail pipeline when variable is not set or individual command has an non-zero exitcode. -set -euo pipefail - -shopt -s expand_aliases - -# Shared constants between jobs -DIR=$(pwd) -GITSHA=$(git rev-parse HEAD || true) -export DIR -export GITSHA -export PS4='(${BASH_SOURCE}:${LINENO}): - [$?] $ ' -export LOGFILE="/opt/domjudge/domserver/webapp/var/log/prod.log" - -CCS_SPECS_PINNED_SHA1='a68aff54c4e60fc2bff2fc5c36c119bffa4d30f1' - -# Shared storage for all artifacts -export GITLABARTIFACTS="$DIR/gitlabartifacts" -mkdir -p "$GITLABARTIFACTS" - -# Functions to annotate the GitLab logs -alias trace_on='set -x' -alias trace_off='{ set +x; } 2>/dev/null' -function section_start_internal() { - echo -e "section_start:$(date +%s):$2[collapsed=$1]\r\e[0K$3" - trace_on -} -function section_end_internal() { - echo -e "section_end:$(date +%s):$1\r\e[0K" - trace_on -} -alias section_start_collap='trace_off ; section_start_internal true' -alias section_start='trace_off ; section_start_internal false' -alias section_end='trace_off ; section_end_internal ' - -function log_on_err() { - echo -e "\\n\\n=======================================================\\n" - echo "Symfony log:" - if sudo test -f "$LOGFILE" ; then - sudo cat "$LOGFILE" - fi -} - -function show_phpinfo() { - phpversion=$1 - section_start_collap phpinfo "Show the new PHP info" - update-alternatives --set php /usr/bin/php"${phpversion}" - php -v - php -m - section_end phpinfo -} - -# Show running command -set -x diff --git a/gitlab/default-nginx b/gitlab/default-nginx deleted file mode 100644 index f27f32a0ec..0000000000 --- a/gitlab/default-nginx +++ /dev/null @@ -1,12 +0,0 @@ -server { - listen 80 default_server; - listen [::]:80 default_server; - root /var/www/html; - index index.html index.htm index.nginx-debian.html; - server_name _; - location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; - } -}