Merge branch '2165-public-sources' into 'master'

Make remote source selection based on environment variable

Closes #2165

See merge request !1497
This commit is contained in:
Marin Jankovski 2017-04-20 15:18:53 +00:00
commit f0cab0c6dc
4 changed files with 49 additions and 45 deletions

View File

@ -1,73 +1,52 @@
gitlab-rails:
remote: "git@dev.gitlab.org:gitlab/gitlabhq.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-ce.git"
gitlab-rails-ee:
remote: "git@dev.gitlab.org:gitlab/gitlab-ee.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-ee.git"
gitlab-shell:
remote: "git@dev.gitlab.org:gitlab/gitlab-shell.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-shell.git"
gitlab-workhorse:
remote: "git@dev.gitlab.org:gitlab/gitlab-workhorse.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-workhorse.git"
gitlab-pages:
remote: "git@dev.gitlab.org:gitlab/gitlab-pages.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-pages.git"
gitlab-monitor:
remote: "git@dev.gitlab.org:gitlab-org/gitlab-monitor.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-monitor.git"
config_guess:
remote: "git@dev.gitlab.org:omnibus-mirror/config_guess.git"
alternative: "https://gitlab.com/omnibus-mirror/config_guess.git"
omnibus:
remote: "https://dev.gitlab.org/gitlab/omnibus.git"
alternative: "https://gitlab.com/gitlab-org/omnibus.git"
registry:
remote: "git@dev.gitlab.org:omnibus-mirror/distribution.git"
alternative: "https://gitlab.com/omnibus-mirror/distribution.git"
rb-readline:
remote: "git@dev.gitlab.org:omnibus-mirror/rb-readline.git"
alternative: "https://gitlab.com/omnibus-mirror/rb-readline.git"
prometheus:
remote: "git@dev.gitlab.org:omnibus-mirror/prometheus.git"
alternative: "https://gitlab.com/omnibus-mirror/prometheus.git"
node-exporter:
remote: "git@dev.gitlab.org:omnibus-mirror/node_exporter.git"
alternative: "https://gitlab.com/omnibus-mirror/node_exporter.git"
postgres-exporter:
remote: "git@dev.gitlab.org:omnibus-mirror/postgres_exporter.git"
alternative: "https://gitlab.com/omnibus-mirror/postgres_exporter.git"
redis-exporter:
remote: "git@dev.gitlab.org:omnibus-mirror/redis_exporter.git"
alternative: "https://gitlab.com/omnibus-mirror/redis_exporter.git"
gitaly:
remote: 'git@dev.gitlab.org:gitlab/gitaly'
alternative: 'https://gitlab.com/gitlab-org/gitaly'
gitlab-elasticsearch-indexer:
remote: 'git@dev.gitlab.org:gitlab/gitlab-elasticsearch-indexer.git'
alternative: 'https://gitlab.com:gitlab-org/gitlab-elasticsearch-indexer.git'
logrotate:
remote: "git@dev.gitlab.org:omnibus-mirror/logrotate.git"
alternative: "https://gitlab.com/omnibus-mirror/logrotate.git"
# For local builds, use the public repositories given below. They are mirrord
# from the internal repositories that GitLab uses.
#gitlab-rails:
#remote: "https://gitlab.com/gitlab-org/gitlab-ce.git"
#gitlab-rails-ee:
#remote: "https://gitlab.com/gitlab-org/gitlab-ee.git"
#gitlab-shell:
#remote: "https://gitlab.com/gitlab-org/gitlab-shell.git"
#gitlab-workhorse:
#remote: "https://gitlab.com/gitlab-org/gitlab-workhorse.git"
#gitlab-pages:
#remote: "https://gitlab.com/gitlab-org/gitlab-pages.git"
#gitlab-monitor:
#remote: "https://gitlab.com/gitlab-org/gitlab-monitor.git"
#omnibus:
#remote: "https://gitlab.com/gitlab-org/omnibus.git"
#config_guess:
#remote: "https://gitlab.com/omnibus-mirror/config_guess.git"
#registry:
#remote: "https://gitlab.com/omnibus-mirror/distribution.git"
#rb-readline:
#remote: "https://gitlab.com/omnibus-mirror/rb-readline.git"
#prometheus:
#remote: "https://gitlab.com/omnibus-mirror/prometheus.git"
#node-exporter:
#remote: "https://gitlab.com/omnibus-mirror/node_exporter.git"
#postgres-exporter:
#remote: "https://gitlab.com/omnibus-mirror/postgres_exporter.git"
#redis-exporter:
#remote: "https://gitlab.com/omnibus-mirror/redis_exporter.git"
#gitaly:
#remote: 'https://gitlab.com/gitlab-org/gitaly'
#gitlab-elasticsearch-indexer:
#remote: 'https://gitlab.com:gitlab-org/gitlab-elasticsearch-indexer.git'
#logrotate:
#remote: "https://gitlab.com/omnibus-mirror/logrotate.git"

View File

@ -47,12 +47,19 @@ follows
```
6. Omnibus GitLab is optimized to use the internal repositories from
dev.gitlab.org. This is specified in the `.custom_sources.yml` file in the
root of the source tree and these repositories are not publicly usable. So,
for personal builds, you have to use public alternatives of these repos.
The alternatives are provided as [comments in the `.custom_sources.yml`](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/.custom_sources.yml#L25-44)
file. So, you can simply uncomment those lines and delete the initially
active options.
dev.gitlab.org. These repositories are specified in the `.custom_sources.yml`
file (specified by `remote` key) in the root of the source tree and will be
used by default. Since these repositories are not publicly usable, for
personal builds you have to use public alternatives of these repos. The
alternatives are also provided in the same file, specified by `alternative`
key. The selection between these two is controlled by `ALTERNATIVE_SOURCES`
environment variable, which can be set either `true` or `false`. If that
variable is set `true`, the repositories marked by `alternative` key will be
used.
Similarly, if you want to use your custom forks as sources, modify the
`.custom_sources.yml` file and specify them as `alternate` and set the
`ALTERNATIVE_SOURCES` variable to `true`.
7. Install the dependencies and generate binaries

View File

@ -11,6 +11,7 @@ module Gitlab
read_version_from_file
end
@project_root = File.join(File.dirname(__dir__), '../')
@software_sources = ENV["ALTERNATIVE_SOURCES"].to_s == "true" ? "alternative" : "remote"
end
def read_version_from_file
@ -62,7 +63,7 @@ module Gitlab
software = YAML.load_file(filepath)[@software]
if software
software['remote']
software[@software_sources]
else
""
end

View File

@ -20,6 +20,23 @@ describe Gitlab::Version do
expect(subject.remote).to eq('')
end
end
context 'without ALTERNATIVE_SOURCES env variable explicitly set' do
let(:software) { 'gitlab-rails-ee' }
it 'returns "remote" link from custom_sources yml' do
expect(subject.remote).to eq('git@dev.gitlab.org:gitlab/gitlab-ee.git')
end
end
context 'with ALTERNATIVE_SOURCES env variable explicitly set' do
let(:software) { 'gitlab-rails-ee' }
it 'returns "remote" link from custom_sources yml' do
allow(ENV).to receive(:[]).with("ALTERNATIVE_SOURCES").and_return("true")
expect(subject.remote).to eq('https://gitlab.com/gitlab-org/gitlab-ee.git')
end
end
end
describe :print do