Skip to content

Commit

Permalink
Remove puppet and chef from CI. (#598)
Browse files Browse the repository at this point in the history
Merged PR #598.
  • Loading branch information
nat-henderson authored and modular-magician committed Oct 23, 2018
1 parent 01f33c8 commit 3c57805
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 432 deletions.
158 changes: 0 additions & 158 deletions .ci/ci.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,6 @@ resources:
uri: [email protected]:((github-account.username))/inspec-gcp.git
private_key: ((repo-key.private_key))

{% for module in vars.puppet_modules %}
- name: puppet-{{module}}-intermediate
type: git-branch
source:
{% if module == '_bundle' %}
uri: [email protected]:((github-account.username))/puppet-google.git
{% else %}
uri: [email protected]:((github-account.username))/puppet-google-{{module}}.git
{% endif %}
private_key: ((repo-key.private_key))
{% endfor %}

{% for module in vars.chef_modules %}
- name: chef-{{module}}-intermediate
type: git-branch
source:
{% if module == '_bundle' %}
uri: [email protected]:((github-account.username))/chef-google.git
{% else %}
uri: [email protected]:((github-account.username))/chef-google-{{module}}.git
{% endif %}
private_key: ((repo-key.private_key))
{% endfor %}

- name: mm-approved-prs
type: github-pull-request
source:
Expand Down Expand Up @@ -181,43 +157,6 @@ jobs:
branch_file: magic-modules-branched/branchname
only_if_diff: true
force: true
{% if vars.puppet_modules %}
- do:
# consumes: magic-modules-branched
# produces: puppet-generated
- task: generate-puppet
file: magic-modules-branched/.ci/magic-modules/generate-puppet.yml
params:
PRODUCTS: {{','.join(vars.puppet_modules)}}
- aggregate:
{% for module in vars.puppet_modules %}
- put: puppet-{{module}}-intermediate
params:
repository: puppet-generated/{{module}}
branch_file: magic-modules-branched/branchname
only_if_diff: true
force: true
{% endfor %}
{% endif %}

{% if vars.chef_modules %}
- do:
# consumes: magic-modules-branched
# produces: chef-generated
- task: generate-chef
file: magic-modules-branched/.ci/magic-modules/generate-chef.yml
params:
PRODUCTS: {{','.join(vars.chef_modules)}}
- aggregate:
{% for module in vars.chef_modules %}
- put: chef-{{module}}-intermediate
params:
repository: chef-generated/{{module}}
branch_file: magic-modules-branched/branchname
only_if_diff: true
force: true
{% endfor %}
{% endif %}
on_failure:
put: magic-modules-new-prs
params:
Expand All @@ -233,8 +172,6 @@ jobs:
# This needs to match the username for the 'intermediate' resources.
GH_USERNAME: ((github-account.username))
CREDS: ((repo-key.private_key))
PUPPET_MODULES: {{','.join(vars.puppet_modules)}}
CHEF_MODULES: {{','.join(vars.chef_modules)}}
TERRAFORM_VERSIONS: "{{','.join(vars.terraform_properties_serialized)}}"
TERRAFORM_ENABLED: true
ANSIBLE_ENABLED: true
Expand Down Expand Up @@ -317,70 +254,6 @@ jobs:
context: inspec-tests
path: magic-modules-new-prs

- name: puppet-test
plan:
- get: magic-modules
version: every
trigger: true
params:
submodules:
{% for module in vars.puppet_submodules %}
- {{module}}
{% endfor %}
passed: [mm-generate]
- aggregate:
{% for module in vars.puppet_modules %}
- task: test-{{module}}
file: magic-modules/.ci/unit-tests/puppet.yml
timeout: 30m
params:
PRODUCT: {{module}}
{%- if vars.puppet_test_excludes.get(module) %}
EXCLUDE_PATTERN: {{','.join(vars.puppet_test_excludes[module])}}
{%- endif %}
{% endfor %}
on_failure:
do:
- get: magic-modules-new-prs
passed: [mm-generate]
- put: magic-modules-new-prs
params:
status: failure
context: puppet-tests
path: magic-modules-new-prs

- name: chef-test
plan:
- get: magic-modules
version: every
trigger: true
params:
submodules:
{% for module in vars.chef_submodules %}
- {{module}}
{% endfor %}
passed: [mm-generate]
- aggregate:
{% for module in vars.chef_modules %}
- task: test-{{module}}
file: magic-modules/.ci/unit-tests/chef.yml
timeout: 30m
params:
PRODUCT: {{module}}
{%- if vars.chef_test_excludes.get(module) %}
EXCLUDE_PATTERN: {{','.join(vars.chef_test_excludes[module])}}
{%- endif %}
{% endfor %}
on_failure:
do:
- get: magic-modules-new-prs
passed: [mm-generate]
- put: magic-modules-new-prs
params:
status: failure
context: chef-tests
path: magic-modules-new-prs

- name: create-prs
plan:
- get: magic-modules
Expand All @@ -390,12 +263,6 @@ jobs:
submodules: {{vars.all_submodules_yaml_format}}
passed:
- mm-generate
{%- if vars.chef_modules %}
- chef-test
{%- endif -%}
{%- if vars.puppet_modules %}
- puppet-test
{%- endif %}
- terraform-test
- ansible-test
- inspec-test
Expand All @@ -416,14 +283,6 @@ jobs:
TERRAFORM_REPO_USER: terraform-providers
ANSIBLE_REPO_USER: modular-magician
INSPEC_REPO_USER: modular-magician
{%- if vars.puppet_modules %}
PUPPET_REPO_USER: GoogleCloudPlatform
PUPPET_MODULES: {{','.join(vars.puppet_modules)}}
{%- endif %}
{%- if vars.chef_modules %}
CHEF_REPO_USER: GoogleCloudPlatform
CHEF_MODULES: {{','.join(vars.chef_modules)}}
{%- endif %}
TERRAFORM_VERSIONS: "{{','.join(vars.terraform_properties_serialized)}}"
on_failure:
put: magic-modules-new-prs
Expand Down Expand Up @@ -466,23 +325,6 @@ jobs:
# See comment on terraform-intermediate
only_if_diff: true
force: true
{% for module in vars.puppet_modules %}
- put: puppet-{{module}}-intermediate
params:
repository: magic-modules-with-comment/build/puppet/{{module}}
branch_file: magic-modules-with-comment/original_pr_branch_name
only_if_diff: true
force: true
{% endfor %}

{% for module in vars.chef_modules %}
- put: chef-{{module}}-intermediate
params:
repository: magic-modules-with-comment/build/chef/{{module}}
branch_file: magic-modules-with-comment/original_pr_branch_name
only_if_diff: true
force: true
{% endfor %}

# This isn't load-bearing - it's just aesthetic. It will also be a no-op the first
# time through, it works the same way as the preceding push.
Expand Down
66 changes: 2 additions & 64 deletions .ci/magic-modules/create-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ echo "$ORIGINAL_PR_BRANCH" > ./original_pr_branch_name
# branch of the terraform submodule. All the submodules will be on the the same
# branch name - we pick terraform because it's the first one the magician supported.
BRANCH_NAME="$(git config -f .gitmodules --get submodule.build/terraform.branch)"
IFS="," read -ra PUPPET_PRODUCTS <<< "$PUPPET_MODULES"
IFS="," read -ra CHEF_PRODUCTS <<< "$CHEF_MODULES"
IFS="," read -ra TERRAFORM_VERSIONS <<< "$TERRAFORM_VERSIONS"

git checkout -b "$BRANCH_NAME"
Expand Down Expand Up @@ -98,65 +96,15 @@ if [ "$BRANCH_NAME" = "$ORIGINAL_PR_BRANCH" ]; then
popd
fi

for PRD in "${PUPPET_PRODUCTS[@]}"; do

pushd "build/puppet/$PRD"

git log -1 --pretty=%B > ./downstream_body
echo "" >> ./downstream_body
echo "<!-- This change is generated by MagicModules. -->" >> ./downstream_body
if [ -n "$ORIGINAL_PR_USER" ]; then
echo "/cc @$ORIGINAL_PR_USER" >> ./downstream_body
fi

git checkout -b "$BRANCH_NAME"
if [[ $PRD == *"_bundle"* ]]; then
repo="puppet-google"
else
repo="puppet-google-$PRD"
fi
if PUP_PR=$(hub pull-request -b "$PUPPET_REPO_USER/$repo:master" -F ./downstream_body); then
DEPENDENCIES="${DEPENDENCIES}depends: $PUP_PR ${NEWLINE}"
else
echo "Puppet $PRD - did not generate a PR."
fi
popd
done

for PRD in "${CHEF_PRODUCTS[@]}"; do

pushd "build/chef/$PRD"

git log -1 --pretty=%B > ./downstream_body
echo "" >> ./downstream_body
echo "<!-- This change is generated by MagicModules. -->" >> ./downstream_body
if [ -n "$ORIGINAL_PR_USER" ]; then
echo "/cc @$ORIGINAL_PR_USER" >> ./downstream_body
fi

git checkout -b "$BRANCH_NAME"
if [[ $PRD == *"_bundle"* ]]; then
repo="chef-google"
else
repo="chef-google-$PRD"
fi
if CHEF_PR=$(hub pull-request -b "$CHEF_REPO_USER/$repo:master" -F ./downstream_body); then
DEPENDENCIES="${DEPENDENCIES}depends: $CHEF_PR ${NEWLINE}"
else
echo "Chef $PRD - did not generate a PR."
fi
popd
done

if [ -z "$DEPENDENCIES" ]; then
cat << EOF > ./pr_comment
cat << EOF > ./pr_comment
I am a robot that works on MagicModules PRs!
I checked the downstream repositories (see README.md for which ones I can write to), and none of them seem to have any changes.
Once this PR is approved, you can feel free to merge it without taking any further steps.
EOF
else
cat << EOF > ./pr_comment
cat << EOF > ./pr_comment
I am a robot that works on MagicModules PRs!
I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed.
Expand All @@ -181,16 +129,6 @@ else
done
fi

for PRD in "${PUPPET_PRODUCTS[@]}"; do
pushd "build/puppet/$PRD"
git branch -f "$ORIGINAL_PR_BRANCH"
popd
done
for PRD in "${CHEF_PRODUCTS[@]}"; do
pushd "build/chef/$PRD"
git branch -f "$ORIGINAL_PR_BRANCH"
popd
done
# Note - we're interested in HEAD~1 here, not HEAD, because HEAD is the
# generated code commit. :)
cat << EOF > ./pr_comment
Expand Down
4 changes: 0 additions & 4 deletions .ci/magic-modules/create-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ params:
TERRAFORM_REPO_USER: ""
ANSIBLE_REPO_USER: ""
INSPEC_REPO_USER: ""
PUPPET_REPO_USER: ""
PUPPET_MODULES: ""
CHEF_REPO_USER: ""
CHEF_MODULES: ""
TERRAFORM_VERSIONS: ""
24 changes: 0 additions & 24 deletions .ci/magic-modules/generate-chef.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .ci/magic-modules/generate-puppet-chef.sh

This file was deleted.

Loading

0 comments on commit 3c57805

Please sign in to comment.