14712: Adds arv-git-httpd to cluster config loading
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Fri, 16 Aug 2019 15:40:14 +0000 (11:40 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Mon, 26 Aug 2019 15:58:34 +0000 (11:58 -0400)
Also removes assert path  from service file

Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>
14712:

Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

lib/config/config.default.yml
lib/config/deprecated.go
lib/config/generated_config.go
lib/config/load.go
sdk/go/arvados/config.go
services/arv-git-httpd/arvados-git-httpd.service

index 163cd87ec5107ee826e1b971eac94fc4f8b1892d..3e098a0029bde060c2c8b5baac7c0f2a64d26a36 100644 (file)
@@ -419,6 +419,17 @@ Clusters:
       ProviderAppID: ""
 
     Git:
+      # Path to git or gitolite-shell executable. Each authenticated
+      # request will execute this program with the single argument http-backend"
+      GitCommand: /usr/bin/git
+
+      # Path to Gitolite's home directory. If a non-empty path is given,
+      # the CGI environment will be set up to support the use of
+      # gitolite-shell as a GitCommand: for example, if GitoliteHome is
+      # "/gh", then the CGI environment will have GITOLITE_HTTP_HOME=/gh,
+      # PATH=$PATH:/gh/bin, and GL_BYPASS_ACCESS_CHECKS=1.
+      GitoliteHome: ""
+
       # Git repositories must be readable by api server, or you won't be
       # able to submit crunch jobs. To pass the test suites, put a clone
       # of the arvados tree in {git_repositories_dir}/arvados.git or
index df872111db2adf8ff1bc504fd0a5b2f31f2b14a6..9eb8c40c18d9455693a9ce18d24d890c528f6d25 100644 (file)
@@ -468,3 +468,44 @@ func (ldr *Loader) loadOldKeepWebConfig(cfg *arvados.Config) error {
        cfg.Clusters[cluster.ClusterID] = *cluster
        return nil
 }
+
+const defaultGitHttpdConfigPath = "/etc/arvados/git-httpd/git-httpd.yml"
+
+type oldGitHttpdConfig struct {
+       Client          *arvados.Client
+       Listen          string
+       GitCommand      string
+       GitoliteHome    string
+       RepoRoot        string
+       ManagementToken string
+}
+
+func (ldr *Loader) loadOldGitHttpdConfig(cfg *arvados.Config) error {
+       if ldr.GitHttpdPath == "" {
+               return nil
+       }
+       var oc oldGitHttpdConfig
+       err := ldr.loadOldConfigHelper("arv-git-httpd", ldr.GitHttpdPath, &oc)
+       if os.IsNotExist(err) && ldr.GitHttpdPath == defaultGitHttpdConfigPath {
+               return nil
+       } else if err != nil {
+               return err
+       }
+
+       cluster, err := cfg.GetCluster("")
+       if err != nil {
+               return err
+       }
+
+       loadOldClientConfig(cluster, oc.Client)
+
+       cluster.Services.GitHTTP.InternalURLs[arvados.URL{Host: oc.Listen}] = arvados.ServiceInstance{}
+       cluster.TLS.Insecure = oc.Client.Insecure
+       cluster.ManagementToken = oc.ManagementToken
+       cluster.Git.GitCommand = oc.GitCommand
+       cluster.Git.GitoliteHome = oc.GitoliteHome
+       cluster.Git.Repositories = oc.RepoRoot
+
+       cfg.Clusters[cluster.ClusterID] = *cluster
+       return nil
+}
index 1eae24d84e540ccc597cc0dcf8f048fadf19514e..d06ed2602a72a75c45fea76978c4ae1fb5e936bd 100644 (file)
@@ -425,6 +425,17 @@ Clusters:
       ProviderAppID: ""
 
     Git:
+      # Path to git or gitolite-shell executable. Each authenticated
+      # request will execute this program with the single argument http-backend"
+      GitCommand: /usr/bin/git
+
+      # Path to Gitolite's home directory. If a non-empty path is given,
+      # the CGI environment will be set up to support the use of
+      # gitolite-shell as a GitCommand: for example, if GitoliteHome is
+      # "/gh", then the CGI environment will have GITOLITE_HTTP_HOME=/gh,
+      # PATH=$PATH:/gh/bin, and GL_BYPASS_ACCESS_CHECKS=1.
+      GitoliteHome: ""
+
       # Git repositories must be readable by api server, or you won't be
       # able to submit crunch jobs. To pass the test suites, put a clone
       # of the arvados tree in {git_repositories_dir}/arvados.git or
index 84de9b60e991de1672ddb4c448faf860d8ee64fb..7e48493939cd67a8322e67fe9f14bf357f26cd76 100644 (file)
@@ -35,6 +35,7 @@ type Loader struct {
        CrunchDispatchSlurmPath string
        WebsocketPath           string
        KeepproxyPath           string
+       GitHttpdPath            string
 
        configdata []byte
 }
@@ -66,6 +67,7 @@ func (ldr *Loader) SetupFlags(flagset *flag.FlagSet) {
        flagset.StringVar(&ldr.CrunchDispatchSlurmPath, "legacy-crunch-dispatch-slurm-config", defaultCrunchDispatchSlurmConfigPath, "Legacy crunch-dispatch-slurm configuration `file`")
        flagset.StringVar(&ldr.WebsocketPath, "legacy-ws-config", defaultWebsocketConfigPath, "Legacy arvados-ws configuration `file`")
        flagset.StringVar(&ldr.KeepproxyPath, "legacy-keepproxy-config", defaultKeepproxyConfigPath, "Legacy keepproxy configuration `file`")
+       flagset.StringVar(&ldr.GitHttpdPath, "legacy-git-httpd-config", defaultGitHttpdConfigPath, "Legacy arv-git-httpd configuration `file`")
        flagset.BoolVar(&ldr.SkipLegacy, "skip-legacy", false, "Don't load legacy config files")
 }
 
@@ -143,6 +145,9 @@ func (ldr *Loader) MungeLegacyConfigArgs(lgr logrus.FieldLogger, args []string,
        if legacyConfigArg != "-legacy-keepproxy-config" {
                ldr.KeepproxyPath = ""
        }
+       if legacyConfigArg != "-legacy-git-httpd-config" {
+               ldr.GitHttpdPath = ""
+       }
 
        return munged
 }
@@ -244,6 +249,7 @@ func (ldr *Loader) Load() (*arvados.Config, error) {
                        ldr.loadOldCrunchDispatchSlurmConfig(&cfg),
                        ldr.loadOldWebsocketConfig(&cfg),
                        ldr.loadOldKeepproxyConfig(&cfg),
+                       ldr.loadOldGitHttpdConfig(&cfg),
                } {
                        if err != nil {
                                return nil, err
index 93f52f3c809bb003c3bb506574d42e140728960c..5a18972f5232127466a1590c023915deef354935 100644 (file)
@@ -114,6 +114,8 @@ type Cluster struct {
                WebDAVCache WebDAVCacheConfig
        }
        Git struct {
+               GitCommand   string
+               GitoliteHome string
                Repositories string
        }
        Login struct {
index 6f8cca856b595498b7f6b8ee387e956e838666a2..7ac160eea33da990b976910de4693f87d97bdbda 100644 (file)
@@ -6,7 +6,6 @@
 Description=Arvados git server
 Documentation=https://doc.arvados.org/
 After=network.target
-AssertPathExists=/etc/arvados/git-httpd/git-httpd.yml
 
 # systemd==229 (ubuntu:xenial) obeys StartLimitInterval in the [Unit] section
 StartLimitInterval=0