Page MenuHomePhabricator

Remove reliance on EXECUTOR_NUMBER environment variable in CI
Closed, ResolvedPublic

Description

In 2015 we introduced usage of EXECUTOR_NUMBER to namespace the temporary directory between builds (Gerrit 198197. As the workload got moved to container, that is no more needed.

We still have some occurrences in code search:

integration/config

dockerfiles/tox-mysqld/example-run.sh
# XXX note wikimedia/fundraising/tools test suite expects the Jenkins env
# variable EXECUTOR_NUMBER to be set.
docker run \
    --rm --tty \
    --env EXECUTOR_NUMBER=1 \
jjb/beta.yaml
# Job to run MediaWiki update.php script on all the beta wikis.
#
# Set TMPDIR to point to the tmpfs if it exists.
- job:
    name: beta-update-databases-eqiad
    defaults: beta
    node: BetaClusterBastion
    builders:
      - shell: |
          # Setup tmpfs directory
          export TMPDIR_FS="/srv/home/jenkins-deploy/tmpfs/jenkins-${EXECUTOR_NUMBER}"
          if [ -d "/srv/home/jenkins-deploy/tmpfs" ]; then
            mkdir -p "$TMPDIR_FS"
            chmod 777 "$TMPDIR_FS"
            export TMPDIR="$TMPDIR_FS"
          fi
          # Teardown tmpfs directory
          function global_teardown() {
              rm -rf "$TMPDIR_FS"
          }
          trap global_teardown EXIT
          /usr/local/bin/wmf-beta-update-databases.py

integration/quibble

quibble/cmd.py
"""
Set and get needed environment variables.
TODO: Can we deprecate any of these in favor of explicit
parameters?
"""
if 'EXECUTOR_NUMBER' not in os.environ:
    os.environ['EXECUTOR_NUMBER'] = '1'

That one in Quibble came from the early days of Quibble and probably came from the 2015 script.

Event Timeline

wikimedia/fundraising/tools has:

silverpop_export/tests/test_update.py
def setup():
    global conn
    global db_name
    # FIXME: parameterize test configuration better
    db_pass = None
    if 'EXECUTOR_NUMBER' in os.environ:
        # We're running under Jenkins.  Assume things.
        db_name = "test"
        db_user = "root"
        db_host = "127.0.0.1"
    else:
        db_name = "test"
        db_user = "test"
        db_host = "database"

Which are the parameters used to connect to the MariaDB server spinned up by the releng/tox-mysqld image. That can be changed to CI.

Change #1168134 had a related patch set uploaded (by Hashar; author: Hashar):

[wikimedia/fundraising/tools@master] Replace EXECUTOR_NUMBER env var by CI

https://gerrit.wikimedia.org/r/1168134

Change #1168134 merged by jenkins-bot:

[wikimedia/fundraising/tools@master] Replace EXECUTOR_NUMBER env var by CI

https://gerrit.wikimedia.org/r/1168134

Change #1168188 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] dockerfiles: remove EXECUTOR_NUMBER from tox example

https://gerrit.wikimedia.org/r/1168188

Change #1168190 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] jjb: beta: remove obsolete tmp dir setup

https://gerrit.wikimedia.org/r/1168190

I can not test the change to the beta update job cause it is not available currently: T399303

Change #1168188 merged by jenkins-bot:

[integration/config@master] dockerfiles: remove EXECUTOR_NUMBER from tox example

https://gerrit.wikimedia.org/r/1168188

Change #1168190 merged by jenkins-bot:

[integration/config@master] jjb: beta: remove obsolete tmp dir setup

https://gerrit.wikimedia.org/r/1168190

Change #1170081 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/quibble@master] Stop setting EXECUTOR_NUMBER environment variable

https://gerrit.wikimedia.org/r/1170081

hashar claimed this task.

Change #1170081 merged by jenkins-bot:

[integration/quibble@master] Stop setting EXECUTOR_NUMBER environment variable

https://gerrit.wikimedia.org/r/1170081