build: added init command
diff --git a/cmd/atmosphere-ci/image_repo_init.go b/cmd/atmosphere-ci/image_repo_init.go
new file mode 100644
index 0000000..d1d6fe9
--- /dev/null
+++ b/cmd/atmosphere-ci/image_repo_init.go
@@ -0,0 +1,41 @@
+package main
+
+import (
+ "context"
+
+ log "github.com/sirupsen/logrus"
+ "github.com/spf13/cobra"
+ "github.com/vexxhost/atmosphere/internal/pkg/image_repositories"
+)
+
+var (
+ imageRepoInitCmd = &cobra.Command{
+ Use: "init [project]",
+ Short: "Initialize image repository",
+ Args: cobra.MinimumNArgs(1),
+
+ Run: func(cmd *cobra.Command, args []string) {
+ ctx := context.TODO()
+
+ repo := image_repositories.NewImageRepository(args[0])
+ err := repo.CreateGithubRepository(ctx)
+ if err != nil {
+ log.Panic(err)
+ }
+
+ err = repo.UpdateGithubConfiguration(ctx)
+ if err != nil {
+ log.Panic(err)
+ }
+
+ err = repo.Synchronize(ctx)
+ if err != nil {
+ log.Panic(err)
+ }
+ },
+ }
+)
+
+func init() {
+ imageRepoCmd.AddCommand(imageRepoInitCmd)
+}
diff --git a/cmd/atmosphere-ci/image_repo_sync.go b/cmd/atmosphere-ci/image_repo_sync.go
index 4a3f608..0db478e 100644
--- a/cmd/atmosphere-ci/image_repo_sync.go
+++ b/cmd/atmosphere-ci/image_repo_sync.go
@@ -22,7 +22,10 @@
repo := image_repositories.NewImageRepository(args[0])
if admin {
- repo.UpdateGithubConfiguration(ctx)
+ err := repo.UpdateGithubConfiguration(ctx)
+ if err != nil {
+ log.Panic(err)
+ }
}
err := repo.Synchronize(ctx)