Skip to content
Snippets Groups Projects
Commit 89da9ba7 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Merge branch 'set-revisions' into 'master'

Add script to set revisions during release

This should make life a little easier during omnibus releases. It can also help for (future) daily builds.

See merge request !380
parents 22b3fda2 03ebcd57
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,17 +13,20 @@ Our main goal is to make it clear which version of GitLab is in an omnibus packa
git pull https://gitlab.com/gitlab-org/omnibus-gitlab.git 6-6-stable # existing release branch
```
 
- Change [the gitlab-rails version in omnibus-gitlab]. In our example that would be
`default_version '490f99d45e0f610e88505ff0fb2dc83a557e22c5' # 6.6.0`.
- Change [the gitlab-shell version] if necessary, for example
`default_version 'c26647b9d919085c669f49c71d0646ac23b9c9d9' # 1.9.4`.
- Change [the gitlab-ci version] if necessary, for example
`default_version 'd69e6b7703043490e0f0f7aa458292fc2ed81fd2' # 5.1.0`.
- Change [the source] to the repo you want to build from (CE / EE)
- Use `support/set-revisions` to set the revisions in `config/software/...`. It
will take tag names and look up the Git SHA1's, and set the download sources to
dev.gitlab.org. Use `set-revisions --ee` for an EE release.
```
# usage: set-revisions [--ee] GITLAB_RAILS_REF GITLAB_CI_REF GITLAB_SHELL_REF
support/set-revisions v6.6.0 v6.6.0 v1.2.3
```
- Commit the new version to the release branch
 
```shell
git commit -m 'Pin GitLab to v6.6.0' config/software/gitlab-rails.rb
git commit -v config/software
```
 
Create an annotated tag on omnibus-gitlab corresponding to the GitLab tag. The
Loading
Loading
#!/bin/sh
main() {
gitlab_rails_ref=$1
gitlab_ci_ref=$2
gitlab_shell_ref=$3
if [ "$ee" = "1" ] ; then
gitlab_rails_repo=git@dev.gitlab.org:gitlab/gitlab-ee.git
else
gitlab_rails_repo=git@dev.gitlab.org:gitlab/gitlabhq.git
fi
gitlab_ci_repo=git@dev.gitlab.org:gitlab/gitlab-ci.git
gitlab_shell_repo=git@dev.gitlab.org:gitlab/gitlab-shell.git
gitlab_rails_oid=$(fetch_oid gitlab_rails)
assert_non_empty gitlab_rails_oid
gitlab_ci_oid=$(fetch_oid gitlab_ci)
assert_non_empty gitlab_ci_oid
gitlab_shell_oid=$(fetch_oid gitlab_shell)
assert_non_empty gitlab_shell_oid
set_source_and_version gitlab_rails config/software/gitlab-rails.rb
set_source_and_version gitlab_ci config/software/gitlab-ci.rb
set_source_and_version gitlab_shell config/software/gitlab-shell.rb
}
# set_source_and_version foo file.rb
# Will look for variables $foo_ref, $foo_repo and $foo_oid. Fills them in in
# file.rb.
set_source_and_version() {
# Change (c) the first line starting with 'default_version '. Jump back to
# the beginning of the file with '1'. Change the first line starting with
# 'source '.
ed -s "$2" <<EOF
H
/^default_version /c
default_version "$(eval echo \$${1}_oid)" # $(eval echo \$${1}_ref)
.
1
/^source /c
source :git => "$(eval echo \$${1}_repo)"
.
wq
EOF
if [ $? -ne 0 ] ; then
warn "Error: ed -s $2 failed"
exit 1
fi
}
# fetch_oid foo
# Query the Git remote at $foo_repo about $foo_ref, return the SHA1 OID
fetch_oid() {
git_ls_remote_cmd="git ls-remote $(eval echo \$${1}_repo) $(eval echo \$${1}_ref)"
result=$(${git_ls_remote_cmd} | awk '{print $1}')
if [ -z "${result}" ] ; then
warn "Error: ${git_ls_remote_cmd} returned no output"
exit 1
fi
echo "${result}"
}
# assert_non_empty foo
# Abort if $foo is unset or the empty string.
assert_non_empty() {
if [ -z "$(eval echo \$$1)" ]; then
warn "Assertion failed: \$$1 is empty"
exit 1
fi
}
warn() {
echo "$@" 1>&2
}
if [ "$1" = "--ee" ] ; then
ee=1
shift
fi
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -n "$4" ] ; then
warn "Usage: $0 [--ee] GITLAB_RAILS_REF GITLAB_CI_REF GITLAB_SHELL_REF"
exit 1
fi
main "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment