What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Is there a way in spryker to configure label expressions for the jenkins jobs? (so the jenkins can b

UK5DS29L2
UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

Is there a way in spryker to configure label expressions for the jenkins jobs? (so the jenkins can be scaled using master-agent)

Comments

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    You mean something like this?

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    intersting.. how to?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    well I already have the nodes, but I'd rather have label expressions done in a non-manual way so we can push them to different environments

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    ah ok so one jenkins for every env?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    No, I want to assign order and stock related tasks to their own agents

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    so they are prioritized over the others

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    sorry, I have no clue. Maybe there is a jenkins plugin available

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer
    edited May 2020

    You can take a look on the scheduler component , there is a generator for each jenkins job definition you could extend to your needs (Spryker\Zed\SchedulerJenkins\Business\TemplateGenerator\XmlJenkinsJobTemplateGenerator).
    We did so to assign all spryker jenkins jobs the same label.
    But having a little logic for different labels, maybe comming from jobs.php shouldn’t be that hard to implement

        /**
         * @param \Generated\Shared\Transfer\SchedulerJobTransfer $jobTransfer
         *
         * @return \Generated\Shared\Transfer\SchedulerJobTransfer
         */
        protected function extendSchedulerJobTransferWithJenkinsAgentLabel(SchedulerJobTransfer $jobTransfer): SchedulerJobTransfer
        {
            $jobPayload = $jobTransfer->getPayload();
    
            if (array_key_exists(static::KEY_JENKINS_AGENT_LABEL, $jobPayload) && is_string($jobPayload[static::KEY_JENKINS_AGENT_LABEL])) {
                return $jobTransfer;
            }
    
            $jobPayload[static::KEY_JENKINS_AGENT_LABEL] = $this->schedulerJenkinsConfig->getJenkinsAgentLabel();
    
            return $jobTransfer->setPayload($jobPayload);
        }