@@ -1641,6 +1641,11 @@ initialize_datadir() {
1641
1641
chmod u+rwX ${GITLAB_SHARED_DIR}
1642
1642
chown ${GITLAB_USER} : ${GITLAB_SHARED_DIR}
1643
1643
1644
+ # create the ci_secure_files directory
1645
+ mkdir -p ${GITLAB_SHARED_DIR} /ci_secure_files
1646
+ chmod u+rwX ${GITLAB_SHARED_DIR} /ci_secure_files
1647
+ chown ${GITLAB_USER} : ${GITLAB_SHARED_DIR} /ci_secure_files
1648
+
1644
1649
# create attifacts dir
1645
1650
mkdir -p ${GITLAB_ARTIFACTS_DIR}
1646
1651
chmod u+rwX ${GITLAB_ARTIFACTS_DIR}
@@ -1983,6 +1988,56 @@ configure_gitlab() {
1983
1988
rm -rf ${GITLAB_INSTALL_DIR} /tmp/sockets/gitlab.socket
1984
1989
}
1985
1990
1991
+ gitlab_configure_feature_flags () {
1992
+ echo " Configuring gitlab::feature_flags..."
1993
+
1994
+ if [[ -z " ${GITLAB_FEATURE_FLAGS_ENABLE_TARGETS} " && -z " ${GITLAB_FEATURE_FLAGS_ENABLE_TARGETS} " ]]; then
1995
+ # Do nothing and reports no error if no targets specified
1996
+ echo " - No targets specified. skipping..."
1997
+ return 0
1998
+ fi
1999
+
2000
+ # Build command line argument for script only when target is specified
2001
+ # If not, scripts fails because option specifier is recognized as feature flags for example
2002
+ # like "--disable --enable" : for this case, --disable is recognized as a value of option "--enable"
2003
+ if [[ -n " ${GITLAB_FEATURE_FLAGS_DISABLE_TARGETS} " ]]; then
2004
+ GITLAB_FEATURE_FLAGS_DISABLE_TARGETS=" --disable ${GITLAB_FEATURE_FLAGS_DISABLE_TARGETS} "
2005
+ fi
2006
+ # The same goes for --enable (this is the last option passed to "rails runner" that will be run below)
2007
+ # For this case (final option), it throws "missing argument" error for execution like:
2008
+ # like "--disable feature1,feature2 --enable"
2009
+ if [[ -n " ${GITLAB_FEATURE_FLAGS_ENABLE_TARGETS} " ]]; then
2010
+ GITLAB_FEATURE_FLAGS_ENABLE_TARGETS=" --enable ${GITLAB_FEATURE_FLAGS_ENABLE_TARGETS} "
2011
+ fi
2012
+
2013
+ PWD_ORG=${PWD}
2014
+ cd " ${GITLAB_INSTALL_DIR} "
2015
+
2016
+ # copy the script to temporal directory : to avoid permission issue
2017
+ cp " ${GITLAB_RUNTIME_DIR} /scripts/configure_feature_flags.rb" " ${GITLAB_TEMP_DIR} /"
2018
+ chown " ${GITLAB_USER} :" " ${GITLAB_TEMP_DIR} /configure_feature_flags.rb"
2019
+
2020
+ echo " - Launching rails runner to set feature flags. This will take some time...."
2021
+
2022
+ # If arguments are empty, the script will do nothing and print object dump like below:
2023
+ # - specified feature flags: {:to_be_disabled=>[], :to_be_enabled=>[]}
2024
+ # DO NOT qupte variables : word splitting must be enabled.
2025
+ # If disabled, whole string like '--disable feature_name_1,feature_name_2'
2026
+ # will be recognized as single option and results to invalid argument error
2027
+ #
2028
+ # shellcheck disable=SC2086
2029
+ exec_as_git bundle exec rails runner " ${GITLAB_TEMP_DIR} /configure_feature_flags.rb" \
2030
+ ${GITLAB_FEATURE_FLAGS_DISABLE_TARGETS} \
2031
+ ${GITLAB_FEATURE_FLAGS_ENABLE_TARGETS}
2032
+
2033
+ rm " ${GITLAB_TEMP_DIR} /configure_feature_flags.rb"
2034
+ cd " ${PWD_ORG} "
2035
+ }
2036
+
2037
+ configure_gitlab_requires_db () {
2038
+ gitlab_configure_feature_flags
2039
+ }
2040
+
1986
2041
configure_gitlab_shell () {
1987
2042
echo " Configuring gitlab-shell..."
1988
2043
update_template ${GITLAB_SHELL_CONFIG} \
0 commit comments