Skip to content
Snippets Groups Projects
Commit b3ae87d4 authored by Fran Garcia-Linares's avatar Fran Garcia-Linares
Browse files

Issue #3417987 by fjgarlin, jonathan1055, jurgenhaas: _GITLAB_TEMPLATES_REF...

Issue #3417987 by fjgarlin, jonathan1055, jurgenhaas: _GITLAB_TEMPLATES_REF value in variables needs updating, and provide override variables for Curl
parent 9df7e38a
No related branches found
No related tags found
1 merge request!115Resolve #3417987 "Fix ref variable"
Pipeline #92802 passed
# GitLab Templates Changelog
## 1.1.1 - 2024-02-08
#3417987 - Fix ability to use a tag, even for files brought via curl.
#3419178 - Increase PHP_MAX to 8.3 (part 1).
#3414377 - Wrong phpunit's junit.xml location in Drupal 10.2.
#3417807 - Being able to ignore CSS files.
## 1.1.0 - 2024-01-30
#3414391 - Changes:
......
......@@ -38,6 +38,7 @@ include:
# - Latest - `ref: main` - Get the latest additions and bug fixes as they are merged into the templates.
# - Minor or Major latests - `ref: 1.x-latest` or `ref: 1.0.x-latest` - Get the latest additions within a minor (mostly bugfixes) or major (bugs and new features).
# - Fixed tag - `ref: 1.0.1` - Set the value to a known tag. This will not get any updates.
# If you change the default value of ref, you should set the _CURL_TEMPLATES_REF variable in the variables section to be the same as set here.
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
......@@ -55,6 +56,8 @@ include:
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
###################################################################################
......
......@@ -46,6 +46,11 @@
echo -e "\e[0Ksection_end:`date +%s`:show_env_vars\r\e[0K"
fi
.calculate-gitlab-ref: &calculate-gitlab-ref
- |
[[ $_CURL_TEMPLATES_REF == "" ]] && export _CURL_TEMPLATES_REF=$_GITLAB_TEMPLATES_REF
[[ $_CURL_TEMPLATES_REPO == "" ]] && export _CURL_TEMPLATES_REPO=$_GITLAB_TEMPLATES_REPO
.simpletest-db: &simpletest-db
- |
# Default to SQLite unless another known type is set.
......@@ -187,10 +192,12 @@ stages:
- .
script:
- *show-environment-variables
- *calculate-gitlab-ref
# Extract Core into default directory then rename to $_WEB_ROOT
- curl https://ftp.drupal.org/files/projects/drupal-$_TARGET_D7_CORE.tar.gz | tar -xz
- mv drupal-$_TARGET_D7_CORE $CI_PROJECT_DIR/$_WEB_ROOT
- curl -OL https://git.drupalcode.org/$_GITLAB_TEMPLATES_REPO/-/raw/$_GITLAB_TEMPLATES_REF/scripts/symlink_project.php
- echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/symlink_project.php"
- curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/symlink_project.php
# We need a composer.json file but do not overwrite if it exists.
- test -f composer.json || echo "{}" > composer.json
# Get the composer version currently installed. Use space or . for delimiters to return the single digit top-level version.
......@@ -245,7 +252,8 @@ phpcs:
when: never
- when: on_success
script:
- test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_GITLAB_TEMPLATES_REPO/-/raw/$_GITLAB_TEMPLATES_REF/scripts/phpcs.xml.dist
- *calculate-gitlab-ref
- test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/phpcs.xml.dist
- vendor/bin/phpcs --basepath=$CI_PROJECT_DIR -s $_WEB_ROOT/sites/all/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
allow_failure: true
artifacts:
......
......@@ -50,6 +50,11 @@
composer global require mglaman/composer-drupal-lenient
fi
.calculate-gitlab-ref: &calculate-gitlab-ref
- |
[[ $_CURL_TEMPLATES_REF == "" ]] && export _CURL_TEMPLATES_REF=$_GITLAB_TEMPLATES_REF
[[ $_CURL_TEMPLATES_REPO == "" ]] && export _CURL_TEMPLATES_REPO=$_GITLAB_TEMPLATES_REPO
.simpletest-db: &simpletest-db
- |
[[ $_TARGET_DB_TYPE == "sqlite" ]] && export SIMPLETEST_DB=sqlite://localhost/sites/default/files/db.sqlite
......@@ -238,13 +243,15 @@ stages:
script:
- *show-environment-variables
- *add-composer-drupal-lenient
- *calculate-gitlab-ref
# Expand the composer.json from the module with defaults to bring the Drupal project.
- curl -OL https://git.drupalcode.org/$_GITLAB_TEMPLATES_REPO/-/raw/$_GITLAB_TEMPLATES_REF/scripts/expand_composer_json.php
- echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/expand_composer_json.php"
- curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/expand_composer_json.php
- php expand_composer_json.php
- composer install $COMPOSER_EXTRA
- rm expand_composer_json.php
# Symlink module files to a module folder so we can do a full Drupal install.
- curl -OL https://git.drupalcode.org/$_GITLAB_TEMPLATES_REPO/-/raw/$_GITLAB_TEMPLATES_REF/scripts/symlink_project.php
- curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/symlink_project.php
- php symlink_project.php
# For Nightwatch et al.
- yarn --cwd $_WEB_ROOT/core install
......@@ -338,7 +345,8 @@ phpcs:
needs:
- composer
script:
- test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_GITLAB_TEMPLATES_REPO/-/raw/$_GITLAB_TEMPLATES_REF/scripts/phpcs.xml.dist
- *calculate-gitlab-ref
- test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/phpcs.xml.dist
- vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
allow_failure: true
artifacts:
......
......@@ -38,15 +38,15 @@ variables:
_TARGET_PHP:
value: "$CORE_PHP_MIN"
description: "Default: The current minimum version of PHP for Drupal core. May be overriden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.variables.yml"
description: "Default: The current minimum version of PHP for Drupal core. May be overriden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/main/includes/include.drupalci.variables.yml"
_TARGET_DB_TYPE:
value: "$MYSQL_PERCONA_MARIADB"
description: "Default: MariaDB is the default database testing environment. May be overridden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.variables.yml"
description: "Default: MariaDB is the default database testing environment. May be overridden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/main/includes/include.drupalci.variables.yml"
_TARGET_DB_VERSION:
value: "$CORE_MYSQL_TEST_DEFAULT"
description: "Default: The current minimum version of MariaDB for Drupal core. May be overridden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.variables.yml"
description: "Default: The current minimum version of MariaDB for Drupal core. May be overridden with any semantic label from: https://git.drupalcode.org/project/gitlab_templates/-/raw/main/includes/include.drupalci.variables.yml"
_WEB_ROOT:
value: "web"
......@@ -193,7 +193,7 @@ variables:
# https://www.drupal.org/drupalorg/docs/drupal-ci/drupalorg-testing-policy#CodeTargets
################
CORE_STABLE:
value: "10.2.2"
value: "10.2.3"
description: "The most recent, stable version of Drupal. Do not override."
CORE_SECURITY:
value: "10.2.2"
......@@ -431,10 +431,32 @@ variables:
################
# Gitlab templates
#
# https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
#
# These variables are only applied when used on:
# - Trigger variables.
# - Scheduled pipeline variables.
# - Manual pipeline run variables.
# - Variables added when creating a pipeline with the API.
#
# They cannot be overriden in a .gitlab-ci.yml template.
################
_GITLAB_TEMPLATES_REPO:
value: "project/gitlab_templates"
description: "The org and machine name of the repo that holds the gitlab CI project. The default is project/gitlab_templates, use issue/gitlab_templates-nnnnnnn for an issue fork."
description: "Only to be used in manual, triggered, downstream or scheduled pipelines, otherwise ignored due to the priority of global variables. The org and machine name of the repo that holds the gitlab CI project. The default is project/gitlab_templates, use issue/gitlab_templates-nnnnnnn for an issue fork."
_GITLAB_TEMPLATES_REF:
value: "1.0.x"
description: "The branch/ref to use during CI. The default is 1.0.x. For issue testing, the format is often nnnnnnn-some-text"
value: "default-ref"
description: "Only to be used in manual, triggered, downstream or scheduled pipelines, otherwise ignored due to the priority of global variables. The branch/ref to use during CI. The default is default-ref. For issue testing, the format is often nnnnnnn-some-text"
################
# Gitlab templates repo and ref used by CURL to get gitlab templates script files.
#
# These variables can be overriden in a .gitlab-ci.yml template.
################
_CURL_TEMPLATES_REPO:
value: ""
description: "Empty by default. Set this to a value in your .gitlab-ci.yml if you are testing a gitlab_templates MR."
_CURL_TEMPLATES_REF:
value: ""
description: "Empty by default. Override this to match `ref:` if you are using a specific non-default tag such as `main` or `1.0.x-latest`, or when testing a gitlab_templates MR."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment