@@ -82,8 +82,17 @@ func run(ctx context.Context) (err error) {
8282 dir := filepath .Join (eco , e .Name ())
8383 fmt .Printf ("[+] Building %s@%s\n " , dir , ver )
8484
85+ // Into which compressed archive
8586 into := filepath .Join (dist , fmt .Sprintf ("%s_%s_%s.oci.tar.gz" , eco , e .Name (), ver ))
86- dhRepoName := fmt .Sprintf ("recipes_%s_%s" , eco , e .Name ())
87+
88+ // Transform into a Docker-compliant name
89+ sub := e .Name ()
90+ sub = strings .ToLower (sub )
91+ sub = strings .NewReplacer (
92+ "." , "-" ,
93+ ).Replace (sub )
94+ dhRepoName := fmt .Sprintf ("recipes_%s_%s" , eco , sub )
95+
8796 if err := build (ctx , dir , into , dhRepoName , ver ); err != nil {
8897 return errors .Wrapf (err , "failed to build %s" , dir )
8998 }
@@ -295,7 +304,7 @@ func compress(path, target string) error {
295304
296305func dhubPush (ctx context.Context , dir , repoName , version string ) error {
297306 // Create the repository if does not exist already
298- if err := dhClient .UpsertRepo (ctx , repoName ); err != nil {
307+ if err := dhClient .UpsertRepo (ctx , dir , repoName ); err != nil {
299308 return errors .Wrapf (err , "upserting ctferio/%s" , repoName )
300309 }
301310
@@ -342,15 +351,15 @@ func Login(ctx context.Context, username, password string) (*DockerHubClient, er
342351 return & DockerHubClient {token : out .Token }, nil
343352}
344353
345- func (c * DockerHubClient ) UpsertRepo (ctx context.Context , name string ) error {
354+ func (c * DockerHubClient ) UpsertRepo (ctx context.Context , dir , name string ) error {
346355 exist , err := c .repoExists (ctx , name )
347356 if err != nil {
348357 return err
349358 }
350359 if exist {
351360 return nil
352361 }
353- return c .createRepo (ctx , name , "Generated from Recipes..." ) // TODO generate description to target URL
362+ return c .createRepo (ctx , name , fmt . Sprintf ( "Generated from https://github.com/ctfer-io/recipes/blob/main/%s" , dir ))
354363}
355364
356365func (c * DockerHubClient ) repoExists (ctx context.Context , name string ) (bool , error ) {
0 commit comments