Skip to content

Commit 1b01326

Browse files
authored
Merge pull request #210 from fog/upgrade-google-client
Upgrade google client to 0.15
2 parents 7a104a2 + cd57efc commit 1b01326

File tree

481 files changed

+7141
-11564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

481 files changed

+7141
-11564
lines changed

.rubocop.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ Style/ConditionalAssignment:
66
SingleLineConditionsOnly: true
77
EnforcedStyle: assign_inside_condition
88

9-
Style/Encoding:
10-
EnforcedStyle: when_needed
11-
129
Style/FormatString:
1310
Enabled: false
1411

@@ -40,15 +37,15 @@ Style/CollectionMethods:
4037
find: detect
4138
find_all: select
4239
reduce: inject
43-
Style/DotPosition:
40+
Layout/DotPosition:
4441
Description: Checks the position of the dot in multi-line method calls.
4542
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
4643
Enabled: true
4744
EnforcedStyle: leading
4845
SupportedStyles:
4946
- leading
5047
- trailing
51-
Style/FileName:
48+
Naming/FileName:
5249
Description: Use snake_case for source file names.
5350
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
5451
Enabled: false
@@ -80,7 +77,7 @@ Style/PercentLiteralDelimiters:
8077
"%w": "()"
8178
"%W": "()"
8279
"%x": "()"
83-
Style/PredicateName:
80+
Naming/PredicateName:
8481
Description: Check the names of predicate methods.
8582
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
8683
Enabled: true
@@ -186,7 +183,7 @@ Lint/AssignmentInCondition:
186183
Style/InlineComment:
187184
Description: Avoid inline comments.
188185
Enabled: true
189-
Style/AccessorMethodName:
186+
Naming/AccessorMethodName:
190187
Description: Check the naming of accessor methods for get_/set_.
191188
Enabled: false
192189
Style/Alias:

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The main maintainers for the Google sections are @icco, @Temikus and @plribeiro3
66

77
**As of v0.1.1, Google no longer supports Ruby versions less than 2.0.0.**
88

9-
**Currently, `fog-google` does not support versions of `google-api-client` >= 0.9 or <= 0.8.5.**
9+
**As of v1.0.0, fog-google includes google-api-client as a dependency**
1010

1111

1212
## Storage
@@ -20,24 +20,20 @@ There are two ways to access [Google Cloud Storage](https://cloud.google.com/sto
2020

2121
Google Compute Engine is a Virtual Machine hosting service. Currently it is built on version [v1](https://developers.google.com/compute/docs/reference/v1/) of the GCE API.
2222

23-
As of 2015-12-07, we believe Fog for Google Compute engine (`Fog::Compute::Google`) is feature complete.
24-
25-
If you are using Fog to interact with GCE, please keep Fog up to date and [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
23+
As of 2017-12-15, we are still working on making Fog for Google Compute engine (`Fog::Compute::Google`) feature complete. If you are using Fog to interact with GCE, please keep Fog up to date and [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
2624

2725
## SQL
2826

29-
Fog implements [v1beta3](https://cloud.google.com/sql/docs/admin-api/v1beta3/) of the Google Cloud SQL Admin API. This is a currently deprecated API. Pull Requests for updates would be greatly appreciated.
27+
Fog implements [v1beta4](https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/) of the Google Cloud SQL Admin API. As of 2017-11-06, Cloud SQL is mostly feature-complete. Please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like as we finish
28+
adding remaining features.
3029

3130
## DNS
3231

3332
Fog implements [v1](https://cloud.google.com/dns/api/v1/) of the Google Cloud DNS API. We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
3433

3534
## Monitoring
3635

37-
Fog mostly implements [v3](https://cloud.google.com/monitoring/api/ref_v3/rest/) of the Google Cloud Monitoring API.
38-
39-
As of 2017-09-26, some less common API methods are missing and may be added as requested. Feature requests or pull requests for
40-
additions are welcome.
36+
Fog implements [v3](https://cloud.google.com/monitoring/api/v3/) of the Google Cloud Monitoring API. As of 2017-10-05, we believe Fog for Google Cloud Monitoring is feature complete for metric-related resources and are working on supporting groups.
4137

4238
We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
4339

@@ -46,7 +42,7 @@ We are always looking for people to improve our code and test coverage, so pleas
4642
Note: You **must** have a version of google-api-client > 0.8.5 to use the Pub/Sub API; previous versions will not work.
4743

4844
Fog mostly implements [v1](https://cloud.google.com/pubsub/reference/rest/) of the Google Cloud Pub/Sub API; however some less common API methods are missing. Pull requests for additions would be greatly appreciated.
49-
45+
5046
## Installation
5147

5248
Add the following two lines to your application's `Gemfile`:
@@ -68,16 +64,22 @@ Or install it yourself as:
6864
$ gem install fog-google
6965
```
7066

67+
## Testing
68+
69+
The tests in `tests` are deprecated. We are currently working on a migration of tests to `minitest`.
70+
71+
For your test to be tested with real credentials, a repo maintainer may add the label `integrate` to your PR to run integration tests.
72+
7173
## Setup
7274

7375
#### Credentials
7476

7577
Follow the [instructions to generate a private key](https://cloud.google.com/storage/docs/authentication#generating-a-private-key). A sample credentials file can be found in `.fog.example` in this directory:
7678

77-
cat .fog.example >> ~/.fog # appends the sample configuration
78-
vim ~/.fog # edit file with yout config
79-
80-
79+
```
80+
cat .fog.example >> ~/.fog # appends the sample configuration
81+
vim ~/.fog # edit file with yout config
82+
```
8183

8284
#### SSH-ing into instances
8385

@@ -99,4 +101,4 @@ $ bundle exec pry
99101

100102
## Contributing
101103

102-
See `CONTRIBUTING.md` in this repository.
104+
See `CONTRIBUTING.md` in this repository.

ci/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
credentials.yml

ci/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# fog-google CI
2+
3+
This pipeline performs two functions.
4+
5+
1. Performing an integration test of the
6+
upgrade-google-client branch whenever new changes appear there.
7+
8+
1. Running integration tests against every PR with the
9+
`integrate` label. This allows whitelisted PRs to be tested
10+
automatically before being merged. Status is updated on the
11+
PR when the test completes.
12+
13+
## Setup
14+
15+
In order to run the fog-google Concourse Pipeline you must have an existing
16+
[Concourse](http://concourse.ci) environment.
17+
See [Deploying Concourse on Google Compute Engine](https://github.com/cloudfoundry-incubator/bosh-google-cpi-release/blob/master/docs/deploy_concourse.md)
18+
for instructions.
19+
20+
To deploy the pipeline:
21+
22+
* Download the `fly` binary from the Concourse web interface and place it in your `$PATH`.
23+
24+
* Login to your Concourse:
25+
26+
```
27+
fly -t fog-google login -c <YOUR CONCOURSE URL>
28+
```
29+
30+
* Update the [credentials.yml](https://github.com/fog/fog-google/blob/master/ci/credentials.yml.tpl)
31+
file. See [Credentials Requirements](#credentials-requirements) for specific instructions.
32+
33+
* Set the fog-google pipeline:
34+
35+
```
36+
fly -t fog-google set-pipeline -p fog-google -c pipeline.yml -l credentials.yml
37+
```
38+
39+
* Unpause the fog-google pipeline:
40+
41+
```
42+
fly -t fog-google unpause-pipeline -p fog-google
43+
```
44+
45+
## Credentials Requirements
46+
47+
Several external pieces of authentication are needed for credentials.yml
48+
49+
1. A JSON Service Account File for a service account with at least Editor access to the project.
50+
* To get a Service Account File, see [here](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount)
51+
and create using the Project/Editor role.
52+
53+
1. A [Github Access Token](https://github.com/blog/1509-personal-api-tokens) with at least
54+
`repo:status` access and a private key with push access to the `fog/fog-google` repositoy.
55+
56+
These items are equivalent to your login credentials for their resources.
57+
58+
## Login Gotchas
59+
60+
* If your Concourse deployment is using a self-signed certificate, use `--insecure` to
61+
trust the provided certificate.
62+
63+
* If logging into a specific team, ie `fog-google`, use `--team-name fog-google` to specify that.
64+
65+
## Dockerfile
66+
67+
The [docker-image](https://github.com/fog/fog-google/blob/master/ci/docker-image) directory contains
68+
the Dockerfile necessary for recreating the Docker image used in tasks. This is referenced
69+
in a per-task basis as `image_resource`, ie in
70+
image_resource [run-int.yml](https://github.com/fog/fog-google/blob/master/ci/tasks/run-int.yml)

ci/credentials.yml.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
# Google Cloud Platform project to run under
3+
google_project:
4+
# Google Compute Engine Service Account email
5+
google_client_email:
6+
# Google Compute Engine Service Account JSON
7+
google_json_key_data: |
8+
9+
# An access token with repo:status access
10+
github_access_token:
11+
# A SSH private key associated with the access token's account or
12+
# a repo push deploy key
13+
github_private_key: |

ci/docker-image/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:16.04
2+
3+
# Packages
4+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -qq update && apt-get -y -qq install \
5+
build-essential \
6+
curl \
7+
git \
8+
zlib1g-dev \
9+
libssl-dev \
10+
libreadline-dev \
11+
libyaml-dev \
12+
libxml2-dev \
13+
libxslt-dev
14+
15+
# Ubuntu 16.04 will fetch us 2.3.x without any issues.
16+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ruby ruby-dev
17+
18+
RUN apt-get clean
19+
20+
RUN gem install bundler

ci/pipeline.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
jobs:
2+
- name: base-int
3+
plan:
4+
- aggregate:
5+
- {
6+
get: fog-google-src, resource: fog-google-src-in, trigger: true
7+
}
8+
9+
- task: full-integration-tests
10+
file: fog-google-src/ci/tasks/run-int.yml
11+
params:
12+
google_project: {{google_project}}
13+
google_json_key_data: {{google_json_key_data}}
14+
google_client_email: {{google_client_email}}
15+
16+
- name: pr-int
17+
plan:
18+
- get: fog-google-src
19+
resource: pull-request
20+
version: every
21+
trigger: true
22+
- put: pull-request
23+
params: {path: fog-google-src, status: pending}
24+
25+
- task: full-integration-tests
26+
file: fog-google-src/ci/tasks/run-int.yml
27+
params:
28+
google_project: {{google_project}}
29+
google_json_key_data: {{google_json_key_data}}
30+
google_client_email: {{google_client_email}}
31+
on_success:
32+
put: pull-request
33+
params:
34+
path: fog-google-src
35+
status: success
36+
on_failure:
37+
put: pull-request
38+
params:
39+
path: fog-google-src
40+
status: failure
41+
42+
resources:
43+
- name: fog-google-src-in
44+
type: git
45+
source:
46+
uri: https://github.com/fog/fog-google.git
47+
branch: upgrade-google-client
48+
- name: pull-request
49+
type: pull-request
50+
source:
51+
access_token: {{github_access_token}}
52+
private_key: {{github_private_key}}
53+
label: integrate
54+
repo: fog/fog-google
55+
56+
resource_types:
57+
# This is a third party resource.
58+
# The referenced docker-image is maintained externally
59+
# https://github.com/jtarchie/pullrequest-resource
60+
- name: pull-request
61+
type: docker-image
62+
source:
63+
repository: jtarchie/pr

ci/tasks/run-int.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
my_dir="$( cd $(dirname $0) && pwd )"
6+
release_dir="$( cd ${my_dir} && cd ../.. && pwd )"
7+
workspace_dir="$( cd ${release_dir} && cd ../../../.. && pwd )"
8+
9+
pushd ${release_dir} > /dev/null
10+
11+
source ci/tasks/utils.sh
12+
13+
popd > /dev/null
14+
15+
check_param google_project
16+
check_param google_client_email
17+
check_param google_json_key_data
18+
19+
echo $google_json_key_data > `pwd`/service_account_key.json
20+
21+
cat >~/.fog <<EOL
22+
test:
23+
google_project: ${google_project}
24+
google_client_email: ${google_client_email}
25+
google_json_key_location: `pwd`/service_account_key.json
26+
EOL
27+
28+
pushd ${release_dir} > /dev/null
29+
30+
bundle install
31+
32+
FOG_MOCK=false rake test
33+
34+
popd > /dev/null

ci/tasks/run-int.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
platform: linux
3+
image_resource:
4+
type: docker-image
5+
source: {repository: everlag/fog-google}
6+
inputs:
7+
- name: fog-google-src
8+
path: src/fog-google
9+
run:
10+
path: src/fog-google/ci/tasks/run-int.sh
11+
params:
12+
google_project: replace-me
13+
google_client_email: replace-me
14+
google_json_key_data: |
15+
replace-me

ci/tasks/utils.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
check_param() {
4+
local name=$1
5+
local value=$(eval echo '$'$name)
6+
if [ "$value" == 'replace-me' ]; then
7+
echo "environment variable $name must be set"
8+
exit 1
9+
fi
10+
}

0 commit comments

Comments
 (0)