-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nightly release pipeline for Ansible (#1330)
Merged PR #1330.
- Loading branch information
1 parent
d32f620
commit 2c10204
Showing
12 changed files
with
261 additions
and
274 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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
pushd "magic-modules-gcp/build/ansible" | ||
git remote add origin git@github.com:modular-magician/ansible.git | ||
|
||
../../tools/ansible-pr/run.sh |
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,19 @@ | ||
--- | ||
# This file takes one input: magic-modules-branched in detached-HEAD state | ||
# It will create a series of PRs on Ansible. | ||
platform: linux | ||
|
||
image_resource: | ||
type: docker-image | ||
source: | ||
repository: gcr.io/magic-modules/go-ruby-python | ||
tag: '1.11.5-2.6.0-2.7' | ||
|
||
inputs: | ||
- name: magic-modules-gcp | ||
|
||
run: | ||
path: "magic-modules-gcp/.ci/magic-modules/release-ansible.sh" | ||
|
||
params: | ||
GITHUB_TOKEN: "" |
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 |
---|---|---|
|
@@ -10,3 +10,7 @@ group :test do | |
gem 'rspec' | ||
gem 'rubocop', '~> 0.63.1' | ||
end | ||
|
||
group :pr_script do | ||
gem 'octokit' | ||
end |
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
Submodule terraform
updated
from 07af25 to 4510fb
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,103 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright 2017 Google Inc. | ||
# 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. | ||
|
||
require 'optparse' | ||
require_relative '../../compile/core' | ||
require 'octokit' | ||
require 'time' | ||
|
||
# Class to handle Compile include to avoid Rubocop issues. | ||
class CompileClass | ||
include Compile::Core | ||
end | ||
|
||
@options = { | ||
directory: "#{Dir.pwd}/build/ansible/", | ||
dry_run: false, | ||
# Get all PRs from one day ago. | ||
date: (Time.now - (3600 * 24)).iso8601 | ||
} | ||
|
||
TEMPLATE = " | ||
<%= ctx[:commit_msg] %> | ||
##### SUMMARY | ||
<%= ctx[:commit_msg] %> | ||
<% if ctx[:prs] && !ctx[:prs].empty?-%> | ||
This PR is the result of the following Magic Modules PRs: | ||
<% ctx[:prs].each do |pr| -%> | ||
- [<%= pr[:title] -%>](<%= pr[:url] -%>) | ||
<% end -%> | ||
<% end -%> | ||
##### ISSUE TYPE | ||
<% if ctx[:new] -%> | ||
- New Module Pull Request | ||
<% else -%> | ||
- Bugfix Pull Request | ||
<% end -%> | ||
##### ADDITIONAL INFORMATION | ||
``` | ||
This was generated by [Magic Modules](https://github.com/googlecloudplatform/magic-modules) | ||
``` | ||
".freeze | ||
|
||
@options = { | ||
new: false, | ||
mod_name: '', | ||
date: (Time.now - (3600 * 24)).iso8601, | ||
creds: nil | ||
} | ||
|
||
def all_pr_messages | ||
# Limit of 50 bug fixes will go into a PR (should never hit this limit) | ||
client = Octokit::Client.new(access_token: @options[:creds], per_page: 50) | ||
client.list_issues('googlecloudplatform/magic-modules', | ||
labels: 'ansible,downstream-generated', | ||
state: 'closed', since: @options[:date].strip) | ||
.map { |pr| { title: pr[:title], url: pr[:html_url] } } | ||
end | ||
|
||
OptionParser.new do |opts| | ||
opts.banner = 'Usage: run [options]' | ||
|
||
opts.on('--new-module-name [NAME]') do |v| | ||
@options[:new] = true | ||
@options[:mod_name] = v | ||
end | ||
|
||
opts.on('--date [DATE (as ISO8601 String)]', | ||
'Find all GitHub issues with Ansible label after this date') do |v| | ||
@options[:date] = v | ||
end | ||
|
||
opts.on('--github-creds [CREDS]', 'Github creds') do |v| | ||
@options[:creds] = v | ||
end | ||
end.parse! | ||
|
||
message = if @options[:new] | ||
"New GCP module: #{@options[:mod_name]}" | ||
else | ||
"Bug fixes for GCP (as of #{@options[:date]})" | ||
end | ||
|
||
puts CompileClass.new.lines( | ||
CompileClass.new.compile_string({ | ||
commit_msg: message, | ||
new: @options[:new], | ||
prs: all_pr_messages | ||
}, TEMPLATE) | ||
) |
Oops, something went wrong.