-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating documentation, code cleanup
- Loading branch information
1 parent
531b459
commit fb64429
Showing
4 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bbgoget | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Quick and dirty hack to make nice with bitbucket privately hosted repositories that only allow ssh access. In order to set this up, | ||
|
||
go get github.com/myENA/bbgoget | ||
|
||
Alternately you can download the rpm or the tarball from the Releases tab. | ||
|
||
As an example configuration, with Apache httpd running on 443 proxying for bitbucket, you could add the following to | ||
httpd.conf section before the redirects to bitbucket's http service: | ||
|
||
RewriteEngine on | ||
RewriteCond "%{QUERY_STRING}" "go-get" | ||
RewriteRule "^/(.*)" "http://localhost:8800/$1" [P] | ||
|
||
This assumes bbgoget running locally on port 8800. | ||
|
||
The integration with bitbucket is minimal / dumb. It has no knowledge whether or not you actually have a repository | ||
at the requested location. It doesn't really need to, go get will figure out soon enough if the response ends up | ||
going nowhere. The up side is this makes configuration easier. No API access required, minimal configuration. | ||
As an added benefit of being unconcerned with tight integration with bitbucket, there is a very good chance this | ||
would work with other git servers. Also - and most importantly - this made it very easy to author. | ||
|
||
|
||
We've only tested it with our specific configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
%define debug_package %{nil} | ||
|
||
Name: bbgoget | ||
Version: 0.1.1 | ||
Release: 1%{?dist} | ||
Summary: This makes bitbucket server private repos work with go get | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-build | ||
|
||
|
||
Group: System Environment/Daemons | ||
License: MIT | ||
|
||
%define pkgpath github.com/myENA/%{name} | ||
URL: https://github.com/myENA/bbgoget | ||
|
||
%undefine _disable_source_fetch | ||
Source0: https://%{pkgpath}/archive/v%{version}.tar.gz | ||
%define SHA256SUM0 66bd46fd6f8c73f2413f5c3dd9a9fcc1581953c2121813ca5a4089e37e717df8 | ||
BuildRequires: systemd-units golang | ||
|
||
%define bbgoget_user bbgoget | ||
%define bbgoget_group bbgoget | ||
%define bbgoget_home /etc/sysconfig | ||
|
||
Requires(pre): shadow-utils | ||
Requires(post): systemd | ||
Requires(preun): systemd | ||
Requires(postun): systemd | ||
|
||
%description | ||
bitbucket server private repos + go get = gravy | ||
|
||
%pre | ||
getent group %{bbgoget_group} >/dev/null || \ | ||
groupadd -r %{bbgoget_group} | ||
getent passwd %{bbgoget_user} >/dev/null || \ | ||
useradd -r -g %{bbgoget_user} -d %{bbgoget_home} \ | ||
-s /sbin/nologin -c %{name} %{bbgoget_user} | ||
exit 0 | ||
|
||
|
||
%prep | ||
echo "%{SHA256SUM0} %{SOURCE0}" | sha256sum -c - | ||
|
||
%setup -q | ||
mkdir -p go/{src,pkg,bin} | ||
mkdir -p go/src/$(dirname %{pkgpath}) | ||
ln -s $(pwd) go/src/%{pkgpath} | ||
|
||
|
||
%build | ||
export GOPATH=$(pwd)/go | ||
cd go/src/%{pkgpath} | ||
pwd | ||
ls -la | ||
go build | ||
|
||
|
||
%install | ||
%{__install} -p -D -m 0644 go/src/%{pkgpath}/%{name}.service %{buildroot}%{_unitdir}/%{name}.service | ||
|
||
%{__install} -p -D -m 0644 go/src/%{pkgpath}/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name} | ||
|
||
%{__install} -p -D -m 0755 go/src/%{pkgpath}/%{name} %{buildroot}%{_bindir}/%{name} | ||
|
||
|
||
%post | ||
%systemd_post %{name}.service | ||
|
||
%preun | ||
%systemd_preun %{name}.service | ||
|
||
%postun | ||
%systemd_postun_with_restart %{name}.service | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{_unitdir}/%{name}.service | ||
%{_bindir}/%{name} | ||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} | ||
|
||
%changelog |