leopardslab / dunner-gocd-plugin

GoCD task plugin for Dunner, the docker task runner. https://github.com/leopardslab/dunner https://gocd.org
https://github.com/leopardslab/dunner
MIT License
7 stars 1 forks source link

What is an image parameter? #2

Open lukyanov opened 4 years ago

lukyanov commented 4 years ago

Hello!

What should I specify as an image here: https://github.com/leopardslab/dunner-gocd-plugin/blob/master/docs/images/create_dunner_task.png

If I use gocd agents as docker containers, should I specify the gocd agent image there? That sounds strange as the Dunner task will run inside a gocd agent anyway.

If I use gocd agents as machines, why specify a docker image at all?

Could you suggest?

apoorvam commented 4 years ago

@lukyanov You should specify the name of the docker image that you want to use to run the tasks. For example if I want to run a golang application in the container(on go agent machine), I will specify image as "golang:latest".

This pulls the golang image so I have necessary environment to run my application. You can similarly use any of nodejs, java or plain vanilla linux docker images.

lukyanov commented 4 years ago

Ok, but Dunner config also specifies images to run your commands against, right? How those two types of images relate to each other? So, there is "golang:latest". Then Dunner starts other containers inside the first one to run its commands, right? What is the point here?

I never used Dunner before, so forgive me my probably stupid questions :)

apoorvam commented 4 years ago

Its only one image thats specified. For a dunner task, the "image" is the image thats pulled and all the commands are run in that image. If you want another image, you can create another dunner task with gocd plugin and then list down the commands there.

In each dunner task, you can specify a image and a bunch of commands to be run against it.

Alternately, Dunner is available as a command-line tool too. You can refer the documentation here: https://dunner.io/docs/introduction-to-dunner or see this basic usage screencast.

This lets you define the commands with the image in which it should run and lets you organize it. You can check-in the config file that it creates i.e .dunner.yaml file to git and then run dunner do <taskname> from GoCD config. This spins up a docker container in the go agent machine and runs the commands inside it.

lukyanov commented 4 years ago

Sorry for my stupid questions, but I still have some :)

I understand that the Dunner is running the commands inside a docker container. That's why it has "image" as an argument in its configuration (yaml file).

What I don't understand is why the dunner-gocd-plugin also wants me to specify a docker image in GoCD settings. What that image is for?

apoorvam commented 4 years ago

Ah I see your confusion now. If you defined your dunner task already in a file .dunner.yaml, you dont have to use the dunner task in gocd plugin. This plugin helps you define the dunner task(instead of doing it in file) by specifying the image name and commands to be run inside it.

If you have tasks defined already in the file you can just run a simple command in gocd, say dunner do <taskname>. You dont have to use the gocd plugin for it. This plugin is written for users who do not want to define configs in the file, maybe temporary tasks or for newcomers to dunner.

The dunner-gocd-plugin is simulating the behaviour of using dunner from commandline. Internally it also creates a dunner task file and executes it using dunner cli. For new users, this can generate a dunner task file.