Skip to content
This repository was archived by the owner on Feb 18, 2020. It is now read-only.

Commit 0a191fa

Browse files
committed
fix failing tests; install golang-agent from file;
1 parent c6e89a0 commit 0a191fa

File tree

9 files changed

+32
-27
lines changed

9 files changed

+32
-27
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 1.3.1
2+
3+
* #93 Fix GO_SERVER_URL not being set correctly on windows
4+
* #92 fix several issues with installing server on windows
5+
* replaced obsolete gpg key
6+
* install golang agent as a binary from bintray
7+
18
# 1.3.0
29

310
* rewritten chef resources to use new custom resource syntax

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The **apt** repository can be overriden by changing any these attributes:
3939
* `node['gocd']['repository']['apt']['components'] = [ '/' ]`
4040
* `node['gocd']['repository']['apt']['distribution'] = ''`
4141
* `node['gocd']['repository']['apt']['keyserver'] = 'pgp.mit.edu'`
42-
* `node['gocd']['repository']['apt']['key'] = '0xd8843f288816c449'`
42+
* `node['gocd']['repository']['apt']['key'] = 'https://download.go.cd/GOCD-GPG-KEY.asc'`
4343

4444
The **yum** repository can be overriden by changing any these attributes:
4545

attributes/agent.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@
1818
default['gocd']['agent']['count'] = 1
1919
default['gocd']['agent']['default_extras'] = {}
2020

21-
default['gocd']['agent']['golang']['repository']['uri'] = 'https://dl.bintray.com/alex-hal9000/gocd-golang-agent'
22-
default['gocd']['agent']['golang']['repository']['apt']['components'] = ['main']
23-
default['gocd']['agent']['golang']['repository']['apt']['distribution'] = 'master'
24-
default['gocd']['agent']['golang']['repository']['apt']['keyserver'] = 'hkp://keyserver.ubuntu.com:80'
25-
default['gocd']['agent']['golang']['repository']['apt']['key'] = '379CE192D401AB61'
21+
default['gocd']['agent']['golang']['version'] = '1.6'

libraries/helpers.rb

+7
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ def go_server_package_url
208208
"#{go_baseurl}/#{remote_version}/#{os_dir}/#{go_server_remote_package_name}"
209209
end
210210
end
211+
212+
def arch
213+
node['kernel']['machine'] =~ /x86_64/ ? 'amd64' : node['kernel']['machine']
214+
end
215+
def os
216+
node['os']
217+
end
211218
end
212219
end
213220

metadata.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description "Installs/Configures Go servers and agents"
33
maintainer "GoCD Contributors"
44
maintainer_email "go-cd@googlegroups.com"
5-
version "1.3.0"
5+
version "1.3.1"
66

77
supports "ubuntu"
88
supports "centos"

recipes/agent_linux_install.rb

+6-9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@
4444
case node['platform_family']
4545
when 'debian'
4646
include_recipe 'apt'
47-
apt_repository 'gocd-golang-agent' do
48-
uri node['gocd']['agent']['golang']['repository']['uri']
49-
components node['gocd']['agent']['golang']['repository']['apt']['components']
50-
distribution node['gocd']['agent']['golang']['repository']['apt']['distribution']
51-
keyserver node['gocd']['agent']['golang']['repository']['apt']['keyserver'] unless node['gocd']['agent']['golang']['repository']['apt']['keyserver'] == false
52-
key node['gocd']['agent']['golang']['repository']['apt']['key'] unless node['gocd']['agent']['golang']['repository']['apt']['key'] == false
53-
end
54-
apt_package 'gocd-golang-agent' do
55-
options '--force-yes'
47+
agent_version = node['gocd']['agent']['golang']['version']
48+
remote_file '/usr/bin/gocd-golang-agent' do
49+
source "https://bintray.com/gocd-contrib/gocd_golang_goagent/download_file?file_path=goagent%2F#{agent_version}%2Fgocd-golang-agent_#{os}_#{arch}_#{agent_version}"
50+
mode 00755
51+
owner 'root'
52+
group 'root'
5653
end
5754
else
5855
fail 'golang agent installation is only supported on debian-based systems'

spec/go_agent_lwrp_spec.rb

+6-8
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@
5555
it 'does not install java' do
5656
expect(chef_run).to_not include_recipe('java')
5757
end
58-
it 'adds golang apt repository' do
59-
expect(chef_run).to add_apt_repository 'gocd-golang-agent'
60-
end
61-
it 'installs gocd-golang-agent package' do
62-
expect(chef_run).to install_apt_package('gocd-golang-agent').with(
63-
options: '--force-yes'
64-
)
65-
end
6658
it 'creates init.d script for my-go-agent' do
6759
expect(chef_run).to render_file('/etc/init.d/my-go-agent').with_content { |content|
6860
expect(content).to include('Provides: my-go-agent')
@@ -90,11 +82,17 @@
9082
node.automatic['platform_family'] = 'debian'
9183
node.automatic['platform'] = 'debian'
9284
node.automatic['os'] = 'linux'
85+
node.automatic['kernel']['machine'] = 'x86_64'
9386
node.normal['gocd']['agent']['type'] = 'golang'
9487
end
9588
run.converge('gocd_test::default_agent_lwrp')
9689
end
9790
it_behaves_like :my_golang_agent
91+
it 'downloads linux binary' do
92+
expect(chef_run).to create_remote_file('/usr/bin/gocd-golang-agent').with(
93+
source: 'https://bintray.com/gocd-contrib/gocd_golang_goagent/download_file?file_path=goagent%2F1.6%2Fgocd-golang-agent_linux_amd64_1.6'
94+
)
95+
end
9896
it 'does not create autoregister.sh file' do
9997
expect(chef_run).to_not create_gocd_agent_autoregister_file('/mnt/big_drive/config/autoregister.sh')
10098
end

spec/shared_examples.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
expect(chef_run).to add_apt_repository('gocd').with(
1313
uri: 'https://download.go.cd',
1414
keyserver: "pgp.mit.edu",
15-
key: "0xd8843f288816c449",
15+
key: "https://download.go.cd/GOCD-GPG-KEY.asc",
1616
components: ['/'])
1717
end
1818
it 'adds gocd experimental apt repository if experimental flag is turned on' do
@@ -21,7 +21,7 @@
2121
expect(chef_run).to add_apt_repository('gocd').with(
2222
uri: 'https://download.go.cd/experimental',
2323
keyserver: "pgp.mit.edu",
24-
key: "0xd8843f288816c449",
24+
key: "https://download.go.cd/GOCD-GPG-KEY.asc",
2525
components: ['/'])
2626
end
2727
end

test/integration/golangagent/serverspec/go_agent_daemon_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
describe 'golang agent package' do
77
it 'should be installed' do
8-
expect(package('gocd-golang-agent')).to be_installed
8+
expect(file('/usr/bin/gocd-golang-agent')).to exist
99
end
1010
it 'java agent should not be installed' do
1111
expect(package('go-agent')).to_not be_installed

0 commit comments

Comments
 (0)