(Go: >> BACK << -|- >> HOME <<)

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same project config for multiple items #24

Open
thibaultduponchelle opened this issue Jan 4, 2021 · 5 comments
Open

Same project config for multiple items #24

thibaultduponchelle opened this issue Jan 4, 2021 · 5 comments
Labels
question Further information is requested

Comments

@thibaultduponchelle
Copy link
Contributor

The idea is :

  • Define one project dir with a sparrowfile and a sparky.yaml
  • Use it for multiple items (repos or modules) through a list (implementation to be defined) (*)

(*) An extra feature would be github/bitbucket/gitlab org/project/whatever scanning

@thibaultduponchelle
Copy link
Contributor Author

Is the answer "downstream projects" ?

@melezhik
Copy link
Owner
melezhik commented Jan 4, 2021

if you please give more practical example, how this could be used ... ?

@melezhik melezhik added the question Further information is requested label Jan 4, 2021
@thibaultduponchelle
Copy link
Contributor Author
thibaultduponchelle commented Jan 4, 2021

If you have a github org with 100 projects that compiles with ./configure && make && make install
You have to create 100 directories with same files ?

I want one project to scan them all or one project to apply to a list of names (here repo names).

@melezhik
Copy link
Owner
melezhik commented Jan 4, 2021

probably not exactly what we're talking about but this where FTP protocol could be useful.

You can spin up an supplemental application which accepts requests (say through a web hook) and dispatch all of them to the same Sparky build bypassing repo specific parameters.

For example:

.sparky/projects/make/sparky.yml

allow_manual_run: false # this project only built though an supplemental web app, using sparky  FTP proto
sparrowdo:
  docker: debian 
  no_sudo: true  

.sparky/projects/make/sparrowfile

say conf()<repo>;
say conf()<commit>;
# do something with repo and commit, you got the idea

Application's cro http route:

post -> 'queue', :%params {
 
  my $sparky-dir = "{%*ENV<HOME>}./sparky/projects/make";

  my $rnd = ('a' .. 'z').pick(20).join('');

  my $id = "{$rnd}{$*PID}";

  request-body -> (:$repo, :$commit ) {

     # this directory is used as to keep build unique configuration  
     my $build-dir = "/some/local/dir/${$id}"; 
     
    # write up build configuration
    spurt "{$build-dir}/config.pl6", %(
        repo => $repo,
        commit => $commit
     ).perl;

    # write up a trigger data with sparrowdo configuration and build CWD
    spurt "{$sparky-dir}/.triggers/$id", %(
       sparrowdo => %( 
           conf => "{$build-dir}/config.pl6", 
         ),
         description => "build for {$repo and $commit}",
        ).perl
    );
  }
}

You could also see how this is implemented in RakuPlay - https://github.com/melezhik/RakuPlay/blob/main/lib/RakuPlay.rakumod#L40-L61.

@melezhik
Copy link
Owner
melezhik commented Jan 4, 2021

Of course this supplemental application should have a write access to Sparky file system, because it's File Triggering Protocol 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants