Skip to content

Commit

Permalink
support 2.x.x (#9)
Browse files Browse the repository at this point in the history
* try 2.0.0 in ci

* update test cases to support GA 2.0.0 release

* Remove support for pre ga

* update to ga service name

* Remove support for pre ga

* fix windows version typo

* test against new service names

* use new checksum for default config

* use 2.0.0 config

* use correct checksums

* switch to 2.0.1, resolve issue where systemd service is 'not running'

* use 2.0.1 for example version

* use 2.0.1 for example version

* fix config path

* fix config path

* fix checksum due to new path

* fix 2.0.1 service name

* temp disable some runs to save time

* detect service name based on ops agent version

* try 1.0.10 with 2.0.1 upgrade

* Add 1.0.10

* try split builtin

* remove 1.x.x support. test 2.0.1 on windows

* test windows 2.0.1

* enable all
  • Loading branch information
Joseph Sirianni authored Jul 7, 2021
1 parent 3b15751 commit 670010a
Show file tree
Hide file tree
Showing 24 changed files with 65 additions and 119 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- logging
- monitoring
version:
- "1.0.4"
- "2.0.1"
- latest
# distro is the key for determining instance name and gce image
distro:
Expand All @@ -52,9 +52,9 @@ jobs:
exclude:
# invalid combos
- agent_type: logging
version: "1.0.4"
version: "2.0.1"
- agent_type: monitoring
version: "1.0.4"
version: "2.0.1"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
agent_type:
- ops-agent
version:
- "1.0.10"
- "2.0.1"
# distro is the key for determining instance name and gce image
distro:
- windows-2019
Expand Down
4 changes: 2 additions & 2 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# google_cloud_ops::agent { 'ops-agent':
# agent_type => 'ops-agent',
# package_state => 'present',
# version => '1.0.5',
# version => '2.0.1',
# main_config => 'puppet:///modules/example/ops_agent/config.yaml',
# }
define google_cloud_ops::agent (
Expand All @@ -45,7 +45,7 @@
$tmp_dir = "/tmp/${agent_type}"
$script_path = "${tmp_dir}/add-monitoring-agent-repo.sh"
if $agent_type == 'ops-agent' {
$service_name = 'google-cloud-ops-agent.target'
$service_name = 'google-cloud-ops-agent'
$config_path = '/etc/google-cloud-ops-agent/config.yaml'
$script_source = 'https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh'
} elsif $agent_type == 'monitoring' {
Expand Down
45 changes: 0 additions & 45 deletions test/cases/linux/ops-agent/1.0.4/custom_config/config.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions test/cases/linux/ops-agent/2.0.1/custom_config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# <== Enter custom agent configurations in this file.
# See https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration
# for more details.

# This config represents a custom configuration deployed by puppet
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.4',
main_config => '/tmp/cases/linux/ops-agent/1.0.4/custom_config/config.yaml'
version => '2.0.1',
main_config => '/tmp/cases/linux/ops-agent/2.0.1/custom_config/config.yaml'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end

describe package('google-cloud-ops-agent') do
it { should be_installed }
its('version') { should match /1.0.4/ }
its('version') { should match /2.0.1/ }
end

describe file('/etc/google-cloud-ops-agent/config.yaml') do
it { should exist }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
its('sha256sum') { should eq '202256588869d4efc115317829c0435cdd8caf2e876f259509d552e974b4f907' }
its('sha256sum') { should eq '802e5adb76188c88a7192dba0b4f6cfc9d22437ae7c7d98639ccc56d08f48454' }
end

Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.5'
version => '2.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end

describe package('google-cloud-ops-agent') do
it { should be_installed }
its('version') { should match /1.0.4/ }
its('version') { should match /2.0.1/ }
end

describe file('/etc/google-cloud-ops-agent/config.yaml') do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.5',
version => '2.0.1',
package_state => 'absent'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should_not be_enabled }
it { should_not be_running }
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.4'
version => '2.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end

describe package('google-cloud-ops-agent') do
it { should be_installed }
its('version') { should match /1.0.5/ }
its('version') { should match /2.0.1/ }
end

describe file('/etc/google-cloud-ops-agent/config.yaml') do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent', main_config => '/tmp/cases/linux/ops-agent/1.0.4/custom_config/config.yaml'
agent_type => 'ops-agent', main_config => '/tmp/cases/linux/ops-agent/latest/custom_config/config.yaml'
}
4 changes: 2 additions & 2 deletions test/cases/linux/ops-agent/latest/custom_config/spec/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
Expand All @@ -21,7 +21,7 @@
describe package('google-cloud-ops-agent') do
it { should be_installed }
# This code will break, if 2.x.x is ever released
its('version') { should match /1./ }
its('version') { should match /2./ }
end

describe file('/etc/google-cloud-ops-agent/config.yaml') do
Expand Down
4 changes: 2 additions & 2 deletions test/cases/linux/ops-agent/latest/install/spec/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

describe service('google-cloud-ops-agent.target') do
describe service('google-cloud-ops-agent') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
Expand All @@ -21,7 +21,7 @@
describe package('google-cloud-ops-agent') do
it { should be_installed }
# This code will break, if 2.x.x is ever released
its('version') { should match /1./ }
its('version') { should match /2./ }
end

describe file('/etc/google-cloud-ops-agent/config.yaml') do
Expand Down
45 changes: 0 additions & 45 deletions test/cases/windows/ops-agent/1.0.10/custom_config/config.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions test/cases/windows/ops-agent/2.0.1/custom_config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# <== Enter custom agent configurations in this file.
# See https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration
# for more details.

# This config represents a custom configuration deployed by puppet
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.10@1',
main_config => 'C:\ci\puppet\modules\cloud_ops\test\cases\windows\ops-agent\1.0.10\custom_config\config.yaml'
version => '2.0.1@1',
main_config => 'C:\ci\puppet\modules\cloud_ops\test\cases\windows\ops-agent\2.0.1\custom_config\config.yaml'
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

describe file("C:\\Program Files\\Google\\Cloud Operations\\Ops Agent\\config\\config.yaml") do
it { should exist }
its('sha256sum') { should eq '62067d867f435a95e47e2bbeb19c3276e39da064400536304d8347945a04c4ee' }
its('sha256sum') { should eq '8a8443831c2e3aab4aff5c64d7c2b6666c9c3c00045ebdc4121cd6e737369493' }
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

google_cloud_ops::agent {'ops-agent':
agent_type => 'ops-agent',
version => '1.0.10@1'
version => '2.0.1@1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

describe file('C:\Program Files\Google\cloud Operations\Ops Agent\config\config.yaml') do
it { should exist }
its('sha256sum') { should eq '62067d867f435a95e47e2bbeb19c3276e39da064400536304d8347945a04c4ee' }
its('sha256sum') { should eq '8a8443831c2e3aab4aff5c64d7c2b6666c9c3c00045ebdc4121cd6e737369493' }
end

0 comments on commit 670010a

Please sign in to comment.