Adjust Jenkins for a Docker environment

Edit on GitHub

Follow the steps to adjust the Jenkins scheduler to docker like environments:

  1. Update the scheduler configuration settings in src/Pyz/Zed/Scheduler/SchedulerDependencyProvider.php:
// ---------- Scheduler
$config[SchedulerConstants::ENABLED_SCHEDULERS] = [
    SchedulerConfig::SCHEDULER_JENKINS,
];
$config[SchedulerJenkinsConstants::JENKINS_CONFIGURATION] = [
    SchedulerConfig::SCHEDULER_JENKINS => [
        SchedulerJenkinsConfig::SCHEDULER_JENKINS_BASE_URL => 'http://' . getenv('SPRYKER_SCHEDULER_HOST') . ':' . getenv('SPRYKER_SCHEDULER_PORT') . '/',
    ],
];

$config[SchedulerJenkinsConstants::JENKINS_TEMPLATE_PATH] = getenv('SPRYKER_JENKINS_TEMPLATE_PATH');
  1. Using the example in src/Pyz/Zed/Scheduler/SchedulerDependencyProvider.php, put the template where SPRYKER_JENKINS_TEMPLATE_PATH points to:
{% extends 'jenkins-job.default.xml.twig' %}

{% block setup %}{% endblock setup %}

{% block command %}<![CDATA[
    docker run -i --rm \
        your-image \
        -e APPLICATION_STORE={{ job.store }} \
        bash -c \
        "{{ job.command }}"
]]>{% endblock command %}

You can define additional store-specific variables if needed.

  1. Set up deployment, so that the following environment variables are set in the container where console scheduler:setup is run:
  • SPRYKER_SCHEDULER_HOST
  • SPRYKER_SCHEDULER_PORT
  • SPRYKER_JENKINS_TEMPLATE_PATH