Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd06d72236 | |||
| ba6bb6dcd2 | |||
| 1ba08eb092 | |||
| a2f2409c2a | |||
| 8b732edb74 | |||
| 95de63c44f | |||
| 965d4c7f54 | |||
| 120c946cfa | |||
| bf468c0012 | |||
| 8e01c76dfe | |||
| 0bdd787291 | |||
| ac72354d30 | |||
| 441f74185e | |||
| 2eb0734201 | |||
| 731cce855f | |||
| 96eac7d1bd | |||
| 84da285368 | |||
| b2dc321f18 | |||
| 8999a34ea1 | |||
| 21a62d6a20 | |||
| d9b386d83b | |||
| 8363a7772e | |||
| 65b029a677 | |||
| 090d41bc3b | |||
| 1fba0e7cd0 | |||
| 1fc3b251d6 | |||
| 252ef87951 | |||
| 1284889e8f | |||
| d80fecd8bb | |||
| 40e55b9860 | |||
| 8e7b2472e2 | |||
| 4789d65f19 | |||
| f2b271b769 |
+1
-1
@@ -1 +1 @@
|
||||
* @actions/importer
|
||||
* @actions/migration-tools-reviewers
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Bamboo
|
||||
about: Migrate Bamboo pipelines to GitHub Actions
|
||||
title: "[Bamboo]:"
|
||||
labels: bamboo
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
## Inputs
|
||||
|
||||
Plan Slug: _Replace this text with the Bamboo plan slug (e.g. PAN-SLUG) to migrate pipelines from._
|
||||
|
||||
## Available commands
|
||||
|
||||
The following commands can be executed by adding a comment to this issue:
|
||||
|
||||
- `/audit`
|
||||
- `/dry-run --plan-type build|deployment`
|
||||
- `/migrate --plan-type build|deployment --target-url :github-repository-url`
|
||||
|
||||
**Note:** The `plan-type` option will default to `build` if omitted. If any remaining options are missing, the command will not be successful.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Bitbucket
|
||||
about: Migrate Bitbucket pipelines to GitHub Actions
|
||||
title: "[Bitbucket]:"
|
||||
labels: bitbucket
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
## Inputs
|
||||
|
||||
Provide the following required inputs:
|
||||
|
||||
Workspace: _Replace this text with the Bitbucket Workspace to migrate pipelines from._
|
||||
|
||||
## Available commands
|
||||
|
||||
The following commands can be executed by adding a comment to this issue:
|
||||
|
||||
- `/audit`
|
||||
- `/dry-run --repository :repository-name`
|
||||
- `/migrate --repository :repository-name --target-url :github-repository-url`
|
||||
@@ -5,8 +5,7 @@ on:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
ruby_version: 2.7.1
|
||||
# env:
|
||||
# ImageOs must be configured to match the OS of the runner when using self-hosted runners.
|
||||
# ImageOS: ubuntu22
|
||||
|
||||
@@ -14,10 +13,8 @@ jobs:
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby_version }}
|
||||
- name: Install dependencies
|
||||
run: bundle install
|
||||
- name: Run specs
|
||||
@@ -25,10 +22,10 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby_version }}
|
||||
bundler-cache: true
|
||||
- name: Install dependencies
|
||||
run: bundle install
|
||||
- name: Lint
|
||||
|
||||
@@ -13,7 +13,7 @@ defaults:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
GITHUB_INSTANCE_URL: ${{ secrets.GITHUB_INSTANCE_URL || 'https://github.com' }}
|
||||
GITHUB_INSTANCE_URL: ${{ secrets.GH_INSTANCE_URL || 'https://github.com' }}
|
||||
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
|
||||
JENKINS_INSTANCE_URL: ${{ secrets.JENKINS_INSTANCE_URL }}
|
||||
JENKINS_USERNAME: ${{ secrets.jenkins_username }}
|
||||
@@ -26,6 +26,9 @@ env:
|
||||
GITLAB_INSTANCE_URL: ${{ secrets.gitlab_instance_url || 'https://gitlab.com' }}
|
||||
CIRCLE_CI_ACCESS_TOKEN: ${{ secrets.circle_ci_access_token }}
|
||||
CIRCLE_CI_SOURCE_GITHUB_ACCESS_TOKEN: ${{ secrets.circle_ci_source_github_access_token }}
|
||||
BAMBOO_ACCESS_TOKEN: ${{ secrets.bamboo_access_token }}
|
||||
BAMBOO_INSTANCE_URL: ${{ secrets.bamboo_instance_url }}
|
||||
BITBUCKET_ACCESS_TOKEN: ${{ secrets.bitbucket_access_token }}
|
||||
|
||||
jobs:
|
||||
execute-actions-importer:
|
||||
@@ -40,7 +43,7 @@ jobs:
|
||||
gh actions-importer update
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
if: always()
|
||||
with:
|
||||
script: |
|
||||
@@ -50,14 +53,12 @@ jobs:
|
||||
repo: context.repo.repo,
|
||||
labels: ['actions-importer-running']
|
||||
})
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7.1
|
||||
# ImageOs must be configured to match the OS of the runner when using self-hosted runners.
|
||||
# env:
|
||||
# ImageOS: ubuntu22
|
||||
- name: Install dependencies
|
||||
- name: Install Dependencies
|
||||
run: bundle install
|
||||
env:
|
||||
BUNDLE_WITHOUT: development
|
||||
@@ -83,7 +84,7 @@ jobs:
|
||||
gh actions-importer ${{ steps.prepare.outputs.command }} ${{ steps.prepare.outputs.provider }} \
|
||||
${{ steps.prepare.outputs.args }} \
|
||||
--output-dir output
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
path: output/
|
||||
@@ -95,7 +96,7 @@ jobs:
|
||||
filename=$(basename "$path")
|
||||
echo "LOG_FILE_PATH=$path" >> $GITHUB_ENV
|
||||
echo "filename=$filename" >> $GITHUB_OUTPUT
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
path: ${{ env.LOG_FILE_PATH }}
|
||||
@@ -106,11 +107,11 @@ jobs:
|
||||
if: needs.execute-actions-importer.outputs.command == 'audit'
|
||||
needs: execute-actions-importer
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- uses: actions/download-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: output
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs')
|
||||
@@ -141,11 +142,11 @@ jobs:
|
||||
if: needs.execute-actions-importer.outputs.command == 'dry-run'
|
||||
needs: execute-actions-importer
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- uses: actions/download-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: output
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs')
|
||||
@@ -197,7 +198,7 @@ jobs:
|
||||
if: needs.execute-actions-importer.outputs.command == 'migrate'
|
||||
needs: execute-actions-importer
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- uses: actions/download-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: logs
|
||||
@@ -208,7 +209,7 @@ jobs:
|
||||
echo "output=$pullRequest" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
pullRequestPattern: "Pull request: "
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
env:
|
||||
PULL_REQUEST_URL: "${{ steps.pull-request-url.outputs.output }}"
|
||||
with:
|
||||
@@ -233,11 +234,11 @@ jobs:
|
||||
needs: [execute-actions-importer, audit, migrate, dry-run]
|
||||
if: always()
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- uses: actions/download-artifact@v4
|
||||
if: always() && needs.execute-actions-importer.result == 'failure'
|
||||
with:
|
||||
name: logs
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
if: always() && needs.execute-actions-importer.result == 'failure'
|
||||
with:
|
||||
script: |
|
||||
@@ -260,7 +261,7 @@ jobs:
|
||||
repo: context.repo.repo,
|
||||
body
|
||||
})
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
if: always()
|
||||
with:
|
||||
script: |
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
if: ${{ !github.event.repository.is_template }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
let labels = [
|
||||
@@ -26,6 +26,7 @@ jobs:
|
||||
'circle-ci',
|
||||
'gitlab',
|
||||
'travis-ci',
|
||||
'bamboo',
|
||||
'actions-importer-running'
|
||||
];
|
||||
|
||||
|
||||
+6
-1
@@ -1,7 +1,12 @@
|
||||
require:
|
||||
- rubocop-performance
|
||||
|
||||
inherit_gem:
|
||||
rubocop-github:
|
||||
- config/default_edge.yml
|
||||
- config/default.yml
|
||||
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
Lint/AmbiguousBlockAssociation:
|
||||
Exclude:
|
||||
- "spec/**/*"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.7.1
|
||||
3.2.2
|
||||
|
||||
@@ -15,9 +15,9 @@ group :development do
|
||||
gem "pry-byebug", "~> 3.9"
|
||||
gem "rspec", "~> 3.10"
|
||||
gem "rspec-github", "~> 2.3", ">= 2.3.1"
|
||||
gem "rubocop", "~> 0.80", "< 0.81"
|
||||
gem "rubocop-github", "~> 0.14.0"
|
||||
gem "rubocop-performance", "~> 1.6.1"
|
||||
gem "rubocop", "~> 1.5"
|
||||
gem "rubocop-github", "~> 0.2"
|
||||
gem "rubocop-performance", "~> 1.18"
|
||||
gem "ruby-debug-ide", "~> 0.7.2"
|
||||
gem "shoulda-matchers", "~> 4.5.1"
|
||||
end
|
||||
|
||||
+61
-43
@@ -1,75 +1,93 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.0.4.3)
|
||||
activesupport (7.0.7.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
ast (2.4.2)
|
||||
base64 (0.1.1)
|
||||
byebug (11.1.3)
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.2.2)
|
||||
diff-lcs (1.4.4)
|
||||
diff-lcs (1.5.0)
|
||||
dotenv (2.7.6)
|
||||
factory_bot (6.2.0)
|
||||
factory_bot (6.2.1)
|
||||
activesupport (>= 5.0.0)
|
||||
faker (2.19.0)
|
||||
i18n (>= 1.6, < 2)
|
||||
i18n (1.12.0)
|
||||
faker (2.23.0)
|
||||
i18n (>= 1.8.11, < 2)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
json (2.6.2)
|
||||
json (2.6.3)
|
||||
language_server-protocol (3.17.0.3)
|
||||
method_source (1.0.0)
|
||||
minitest (5.18.0)
|
||||
parallel (1.21.0)
|
||||
parser (3.0.3.1)
|
||||
minitest (5.19.0)
|
||||
parallel (1.23.0)
|
||||
parser (3.2.2.3)
|
||||
ast (~> 2.4.1)
|
||||
pry (0.13.1)
|
||||
racc
|
||||
pry (0.14.2)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-byebug (3.9.0)
|
||||
pry-byebug (3.10.1)
|
||||
byebug (~> 11.0)
|
||||
pry (~> 0.13.0)
|
||||
rainbow (3.0.0)
|
||||
pry (>= 0.13, < 0.15)
|
||||
racc (1.7.1)
|
||||
rack (3.0.9.1)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
regexp_parser (2.8.1)
|
||||
require_all (3.0.0)
|
||||
rexml (3.2.5)
|
||||
rspec (3.10.0)
|
||||
rspec-core (~> 3.10.0)
|
||||
rspec-expectations (~> 3.10.0)
|
||||
rspec-mocks (~> 3.10.0)
|
||||
rspec-core (3.10.1)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-expectations (3.10.1)
|
||||
rexml (3.2.6)
|
||||
rspec (3.12.0)
|
||||
rspec-core (~> 3.12.0)
|
||||
rspec-expectations (~> 3.12.0)
|
||||
rspec-mocks (~> 3.12.0)
|
||||
rspec-core (3.12.2)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-expectations (3.12.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-github (2.3.1)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-github (2.4.0)
|
||||
rspec-core (~> 3.0)
|
||||
rspec-mocks (3.10.2)
|
||||
rspec-mocks (3.12.6)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-support (3.10.3)
|
||||
rubocop (0.80.1)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-support (3.12.1)
|
||||
rubocop (1.56.0)
|
||||
base64 (~> 0.1.1)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
parser (>= 3.2.2.3)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.28.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
rubocop-github (0.14.0)
|
||||
rubocop (~> 0.59)
|
||||
rubocop-performance (1.6.1)
|
||||
rubocop (>= 0.71.0)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.29.0)
|
||||
parser (>= 3.2.1.0)
|
||||
rubocop-github (0.19.0)
|
||||
rubocop (>= 1.0.0)
|
||||
rubocop-performance
|
||||
rubocop-rails
|
||||
rubocop-performance (1.18.0)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
rubocop-rails (2.20.2)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
ruby-debug-ide (0.7.3)
|
||||
rake (>= 0.8.1)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby-progressbar (1.13.0)
|
||||
shoulda-matchers (4.5.1)
|
||||
activesupport (>= 4.2.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (2.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -85,11 +103,11 @@ DEPENDENCIES
|
||||
require_all (~> 3.0.0)
|
||||
rspec (~> 3.10)
|
||||
rspec-github (~> 2.3, >= 2.3.1)
|
||||
rubocop (~> 0.80, < 0.81)
|
||||
rubocop-github (~> 0.14.0)
|
||||
rubocop-performance (~> 1.6.1)
|
||||
rubocop (~> 1.5)
|
||||
rubocop-github (~> 0.2)
|
||||
rubocop-performance (~> 1.18)
|
||||
ruby-debug-ide (~> 0.7.2)
|
||||
shoulda-matchers (~> 4.5.1)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.33
|
||||
2.4.18
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The GitHub Actions Importer IssueOps repository demonstrates the functionality necessary to run GitHub Actions Importer commands through Actions and Issues, allowing you to migrate your CI/CD workflows without needing to install software on your local machine. This approach is especially useful for organizations that want to enable self-service migrations to GitHub Actions.
|
||||
|
||||
[GitHub Actions Importer](https://docs.github.com/en/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer) helps plan, forecast, and automate the migration of Azure DevOps, CircleCI, GitLab, Jenkins, and Travis CI pipelines to GitHub Actions. GitHub Actions Importer is distributed as a CLI and offers various commands you can use to migrate pipelines:
|
||||
[GitHub Actions Importer](https://docs.github.com/en/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer) helps plan, forecast, and automate the migration of Azure DevOps, Bamboo, CircleCI, GitLab, Jenkins, and Travis CI pipelines to GitHub Actions. GitHub Actions Importer is distributed as a CLI and offers various commands you can use to migrate pipelines:
|
||||
|
||||
- `audit`: An audit will fetch all the pipelines defined in an existing CI server, convert each pipeline to its equivalent in GitHub Actions, and write a report that summarizes how complete of a migration the GitHub Actions Importer can provide.
|
||||
- `dry-run`: A dry run will fetch a single pipeline definition, convert it to its equivalent in GitHub Actions, and write a file (or files) to disk containing the converted workflow.
|
||||
@@ -13,7 +13,7 @@ The GitHub Actions Importer IssueOps repository demonstrates the functionality n
|
||||
Complete the following steps:
|
||||
|
||||
1. Create a new repository using this repository as the template by clicking [here](https://github.com/actions/importer-issue-ops/generate).
|
||||
2. Create the following labels in this new repository, if they are not already present: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, and `actions-importer-running`.
|
||||
2. Create the following labels in this new repository, if they are not already present: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, `bamboo`, and `actions-importer-running`.
|
||||
3. Add the repository secrets described below that are relevant to the CI/CD providers being migrated.
|
||||
|
||||
### Repository settings
|
||||
@@ -22,7 +22,7 @@ The repository that is created from this template must have one of the following
|
||||
|
||||
- Any action or reusable workflow can be used, regardless of who authored it or where it is defined.
|
||||
- Any action or reusable workflow that matches the specified criteria, plus those defined in a repository within the enterprise, can be used.
|
||||
- Allow actions created by GitHub
|
||||
- Allow actions created by GitHub
|
||||
- Allow actions by marketplace verified creators or icnlude `ruby/setup-ruby@v1` in the allowed list of actions and reusable workflows.
|
||||
|
||||
See the [documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#managing-github-actions-permissions-for-your-repository) for more information related to these settings.
|
||||
@@ -35,7 +35,7 @@ The following secrets are required:
|
||||
|
||||
Optionally, the following secrets can be set:
|
||||
|
||||
- `GITHUB_INSTANCE_URL`: The base URL of your GitHub instance (only required if it is **not** <https://github.com>).
|
||||
- `GH_INSTANCE_URL`: The base URL of your GitHub instance (only required if it is **not** <https://github.com>).
|
||||
|
||||
### Azure DevOps
|
||||
|
||||
@@ -95,6 +95,18 @@ Optionally, the following secrets can be set:
|
||||
|
||||
- `TRAVIS_CI_INSTANCE_URL`: The base URL of your Travis CI instance (only required if it is **not** <https://travis-ci.com>).
|
||||
|
||||
### Bamboo
|
||||
|
||||
The following secrets are required:
|
||||
|
||||
- `BAMBOO_ACCESS_TOKEN`: The personal access token to access the Bamboo instance.
|
||||
- `BAMBOO_INSTANCE_URL`: The base URL of your Bamboo instance.
|
||||
### Bitbucket
|
||||
|
||||
The following secrets are required:
|
||||
|
||||
- `BITBUCKET_ACCESS_TOKEN`: The personal access token to access the BitBucket instance.
|
||||
|
||||
## Pipeline migration
|
||||
|
||||
Once configured, pipelines can be migrated to GitHub Actions by opening an issue with the relevant issue template and following the instructions.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
require "yaml"
|
||||
require "open3"
|
||||
|
||||
require_relative "./../cli"
|
||||
require_relative "../cli"
|
||||
|
||||
issue_content, comment_body, labels = ARGV
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ if File.file?(bundle_binstub)
|
||||
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
abort(
|
||||
"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ if File.file?(bundle_binstub)
|
||||
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
abort(
|
||||
"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ class Arguments
|
||||
arguments.map do |value|
|
||||
unless value.is_a?(Array)
|
||||
value = value.inspect if value.include?(" ")
|
||||
|
||||
|
||||
next value
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bamboo
|
||||
class Audit
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, _)
|
||||
@project = parameter_from_issue("Project", issue_content)
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = []
|
||||
args.push(["--project", @project]) unless @project.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bamboo
|
||||
class DryRun
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, command)
|
||||
@plan_slug = parameter_from_issue("Plan Slug", issue_content)
|
||||
|
||||
@plan_type = command.options.fetch("plan-type", "build")
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = [@plan_type]
|
||||
args.push(["--plan-slug", @plan_slug]) unless @plan_slug.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bamboo
|
||||
class Migrate
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, command)
|
||||
@plan_slug = parameter_from_issue("Plan Slug", issue_content)
|
||||
|
||||
@plan_type = command.options.fetch("plan-type", "build")
|
||||
@target_url = command.options["target-url"]
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = [@plan_type]
|
||||
args.push(["--plan-slug", @plan_slug]) unless @plan_slug.nil?
|
||||
args.push(["--target-url", @target_url]) unless @target_url.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bitbucket
|
||||
class Audit
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, command)
|
||||
@workspace = parameter_from_issue("Workspace", issue_content)
|
||||
|
||||
@project_key = command.options["project-key"]
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = []
|
||||
args.push(["--workspace", @workspace]) unless @workspace.nil?
|
||||
args.push(["--project-key", @project_key]) unless @project_key.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bitbucket
|
||||
class DryRun
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, command)
|
||||
@workspace = parameter_from_issue("Workspace", issue_content)
|
||||
@repository = command.options["repository"]
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = []
|
||||
args.push(["--workspace", @workspace]) unless @workspace.nil?
|
||||
args.push(["--repository", @repository]) unless @repository.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Bitbucket
|
||||
class Migrate
|
||||
include IssueParser
|
||||
|
||||
def initialize(issue_content, command)
|
||||
@workspace = parameter_from_issue("Workspace", issue_content)
|
||||
@repository = command.options["repository"]
|
||||
@target_url = command.options["target-url"]
|
||||
end
|
||||
|
||||
def to_a
|
||||
args = []
|
||||
args.push(["--workspace", @workspace]) unless @workspace.nil?
|
||||
args.push(["--repository", @repository]) unless @repository.nil?
|
||||
args.push(["--target-url", @target_url]) unless @target_url.nil?
|
||||
|
||||
return args unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -11,6 +11,8 @@ class Provider
|
||||
|
||||
PROVIDER_MAP = {
|
||||
"azure-devops" => ::AzureDevops,
|
||||
"bamboo" => ::Bamboo,
|
||||
"bitbucket" => ::Bitbucket,
|
||||
"circle-ci" => ::CircleCI,
|
||||
"gitlab" => ::GitlabCI,
|
||||
"jenkins" => ::Jenkins,
|
||||
|
||||
@@ -11,17 +11,17 @@ RSpec.describe Arguments do
|
||||
|
||||
context "when the command is found" do
|
||||
before do
|
||||
expect(provider).to receive(:module).and_return(::Jenkins).at_least(:once)
|
||||
expect(provider).to receive(:module).and_return(Jenkins).at_least(:once)
|
||||
expect(command).to receive(:classify).and_return("Audit").at_least(:once)
|
||||
expect(command).to receive(:options).and_return({})
|
||||
end
|
||||
|
||||
it { is_expected.to be_a(::Jenkins::Audit) }
|
||||
it { is_expected.to be_a(Jenkins::Audit) }
|
||||
end
|
||||
|
||||
context "when the command is not found" do
|
||||
before do
|
||||
expect(provider).to receive(:module).and_return(::Jenkins).at_least(:once)
|
||||
expect(provider).to receive(:module).and_return(Jenkins).at_least(:once)
|
||||
expect(command).to receive(:classify).and_return("Whoopsie").at_least(:once)
|
||||
end
|
||||
|
||||
@@ -35,10 +35,10 @@ RSpec.describe Arguments do
|
||||
let(:options) { {} }
|
||||
|
||||
before do
|
||||
expect(provider).to receive(:module).and_return(::AzureDevops).at_least(:once)
|
||||
expect(provider).to receive(:module).and_return(AzureDevops).at_least(:once)
|
||||
expect(command).to receive(:classify).and_return("Audit").at_least(:once)
|
||||
expect(command).to receive(:options).and_return(options)
|
||||
expect_any_instance_of(::AzureDevops::Audit).to receive(:to_a).and_return(output)
|
||||
expect_any_instance_of(AzureDevops::Audit).to receive(:to_a).and_return(output)
|
||||
end
|
||||
|
||||
context "when the output is nil" do
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bamboo::Audit do
|
||||
let(:audit) { described_class.new(issue_content, nil) }
|
||||
|
||||
describe "#to_a" do
|
||||
subject { audit.to_a }
|
||||
|
||||
context "when issue_content contains no args" do
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Project:
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
|
||||
context "when issue_content contains a project" do
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Project: Demo
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq([["--project", "Demo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bamboo::DryRun do
|
||||
let(:dry_run) { described_class.new(issue_content, command) }
|
||||
let(:command) { Command.new(comment_body) }
|
||||
|
||||
describe "#to_a" do
|
||||
subject { dry_run.to_a }
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Plan Slug: PAN-PLAN
|
||||
ISSUE
|
||||
end
|
||||
|
||||
context "when the comment body does not contain a plan type" do
|
||||
let(:comment_body) { "/dry-run" }
|
||||
|
||||
it { is_expected.to eq(["build", ["--plan-slug", "PAN-PLAN"]]) }
|
||||
end
|
||||
|
||||
context "when the comment body contains a plan type" do
|
||||
let(:comment_body) { "/dry-run --plan-type deployment" }
|
||||
|
||||
it { is_expected.to eq(["deployment", ["--plan-slug", "PAN-PLAN"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bamboo::Migrate do
|
||||
let(:dry_run) { described_class.new(issue_content, command) }
|
||||
let(:command) { Command.new(comment_body) }
|
||||
|
||||
describe "#to_a" do
|
||||
subject { dry_run.to_a }
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Plan Slug: PAN-PLAN
|
||||
ISSUE
|
||||
end
|
||||
|
||||
context "when the comment body does not contain a pipeline type" do
|
||||
let(:comment_body) { "/migrate" }
|
||||
|
||||
it { is_expected.to eq(["build", ["--plan-slug", "PAN-PLAN"]]) }
|
||||
end
|
||||
|
||||
context "when the comment body contains a plan type" do
|
||||
let(:comment_body) { "/dry-run --plan-type deployment" }
|
||||
|
||||
it { is_expected.to eq(["deployment", ["--plan-slug", "PAN-PLAN"]]) }
|
||||
end
|
||||
|
||||
context "with a target-url" do
|
||||
let(:comment_body) { "/migrate --target-url https://github.com/valet" }
|
||||
|
||||
it { is_expected.to eq(["build", ["--plan-slug", "PAN-PLAN"], ["--target-url", "https://github.com/valet"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bitbucket::Audit do
|
||||
describe "#to_a" do
|
||||
let(:audit) { described_class.new(issue_content, command) }
|
||||
let(:command) { Command.new(comment_body) }
|
||||
let(:comment_body) { "/audit" }
|
||||
|
||||
subject { audit.to_a }
|
||||
|
||||
context "when issue_content contains no args" do
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Workspace:
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
|
||||
context "when issue_content contains a workspace" do
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Workspace: testing
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq([["--workspace", "testing"]]) }
|
||||
end
|
||||
|
||||
context "when the comment body contains a project key" do
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Workspace: testing
|
||||
ISSUE
|
||||
end
|
||||
let(:comment_body) { "/audit --project-key SW" }
|
||||
|
||||
it { is_expected.to eq([["--workspace", "testing"], ["--project-key", "SW"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bitbucket::DryRun do
|
||||
let(:dry_run) { described_class.new(issue_content, command) }
|
||||
let(:command) { Command.new(comment_body) }
|
||||
|
||||
describe "#to_a" do
|
||||
subject { dry_run.to_a }
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Workspace: testing
|
||||
ISSUE
|
||||
end
|
||||
|
||||
context "when the comment body contains a repository" do
|
||||
let(:comment_body) { "/dry-run --repository repo" }
|
||||
|
||||
it { is_expected.to eq([["--workspace", "testing"], ["--repository", "repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bitbucket::Migrate do
|
||||
let(:dry_run) { described_class.new(issue_content, command) }
|
||||
let(:command) { Command.new(comment_body) }
|
||||
|
||||
describe "#to_a" do
|
||||
subject { dry_run.to_a }
|
||||
let(:issue_content) do
|
||||
<<~ISSUE
|
||||
Workspace: testing
|
||||
ISSUE
|
||||
end
|
||||
|
||||
context "when the comment body contains a repository" do
|
||||
let(:comment_body) { "/migrate --repository repo --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq([["--workspace", "testing"], ["--repository", "repo"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -84,7 +84,7 @@ RSpec.describe Provider do
|
||||
LABELS
|
||||
end
|
||||
|
||||
it { is_expected.to eq(::TravisCI) }
|
||||
it { is_expected.to eq(TravisCI) }
|
||||
end
|
||||
|
||||
describe "to_output" do
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ require "factory_bot"
|
||||
require "faker"
|
||||
require "fileutils"
|
||||
|
||||
require_relative "./../cli"
|
||||
require_relative "../cli"
|
||||
|
||||
Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require f }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user