esl / release_poller

3 stars 2 forks source link

[feature] jobs runner #5

Closed sescobb27 closed 6 years ago

sescobb27 commented 6 years ago

Overview

each repo we are polling is going to have a list of tasks that are going to be executed when there is a new release of it, each task will point to a repository which will be cloned in the client machine, a list of commands to execute and the adapter who is going to be in charge of the execution.

  @type runner :: module() # Runner Behaviour e.g Make
  @type source :: module() # Source Behaviour e.g Github

  @type t :: %__MODULE__{
          url: String.t(),
          path: Path.t(),
          env: keyword(),
          commands: list(String.t()), # [build, release, deploy, ...]
          runner: runner(),
          source: source()
        }

  defstruct url: nil, path: nil, env: [], commands: [], runner: Make, source: Github

Github Source Adapter

It is in charge of fetching tasks from Github repositories to be run by the Runner adapter

Make Runner Adapter

It is in charge of running a task via make, make build, make deploy, etc.

Steps

the steps that we are going to execute are the following

git clone --depth 1 $REPO_URL
cd $REPO_NAME
make command1
make command2
# ... etc

TODO

cloud8421 commented 6 years ago

Regarding make integration, might be worth spelunking https://github.com/elixir-lang/elixir_make for os compatibility, sanitisation, etc.

sescobb27 commented 6 years ago

Hi @cloud8421, i was looking the elixir_make project, but it seems it's only a mix task to compile projects with Makefiles, so it would not be of help here, but i'm going to take ideas from there to improve our tool to be more OS independent, thank you for pointing that out.