Strongly welcome!

There is a certain site consisting of frontend, backend, database - the whole project is deployed to docker swarm via the stackfile. There are also tests for java; and jenkins, who runs them, goes to the webmord and, of course, test. All this lives separately and does not intersect with each other.

Question: How can I combine all this? That is, I want to create in jenkins item, which at startup, merges the sources and stack.yaml from the git, raises a local copy of the site, downloads the sources of the tests and runs the tests on the local version of the site.

    1 answer 1

    Add agents to your Jenkins , which will be followed by your CI. For example, using the Self-Organizing Swarm Modules plugin. It deploit Docker Swarm nodes, as Jenkins sleave.
    Then you need to create a pipeline (Jenkinsfile) in which you describe on which agent you need to run using the Pipelines DSL commands ( sh 'docker build' , sh 'docker service create' ). Pipeline can be both declarative and scripted .

    A few examples that can help you:

    • There is one virtual server (node) where jenkins is installed. There you also need to somehow put the swarm (I think, just install the docker, initiate the swarm from this node alone and put jenkins) and deploy the stack on the same host (one node) and test it somehow ... - who know
    • This can be done. You can even without installing additional plugins, but you have to do all the manipulations with Docker via sh() . Another good series of articles on this topic - FCh