github / gh-valet

Valet helps facilitate the migration of Azure DevOps, CircleCI, GitLab CI, Jenkins, and Travis CI pipelines to GitHub Actions.
MIT License
510 stars 35 forks source link

Added `--config-file-path` option to all migrate and dry run commands #106

Closed begonaguereca closed 1 year ago

begonaguereca commented 1 year ago

What's changing?

Adding --config-file-path option to all providers.

Make sure you have the latest version of the Valet container: gh valet update

Build c# project: dotnet build /Users/bguereca/1ESLighthouse/gh-valet/gh-valet/src/Valet/Valet.csproj . . . . .

Azure DevOps commands `output/ado/pipeline.yml` ``` trigger: - main pool: vmImage: ubuntu-latest steps: - script: echo Hello, world! displayName: 'Run a one-line script' - script: | echo Add other tasks to build, test, and deploy your project. echo See https://aka.ms/yaml displayName: 'Run a multi-line script' ``` also `output/ado/config.yaml`: ``` source_files: - repository_slug: valet-testing/build-playground path: output/ado/pipeline.yml - repository_slug: valet-testing/unit/directed-acrylic-graph-pipeline path: output/ado/pipeline.yml ``` ________________________________ πŸš— Run a dry-run with `source-file-path`: `dotnet run --project src/Valet/Valet.csproj -- dry-run azure-devops pipeline -o "output" --config-file-path output/config.yml` MIGRATE `dotnet run --project src/Valet/Valet.csproj -- migrate azure-devops pipeline -o "output" --config-file-path output/config.yml --target-url "https://github.com/begonaguereca/demo"` AUDIT `dotnet run --project src/Valet/Valet.csproj -- audit azure-devops -o "output" --config-file-path "output/config.yml" `
Circle CI commands Make sure you add a sample Circle pipeline to `output/circle/pipeline.yml` ``` version: 2.1 orbs: ruby: circleci/ruby@1.1.0 node: circleci/node@2 jobs: build: docker: - image: cimg/ruby:2.7-node steps: - checkout - ruby/install-deps # Store bundle cache - node/install-packages: pkg-manager: yarn cache-key: "yarn.lock" test: parallelism: 3 docker: - image: cimg/ruby:2.7-node - image: circleci/postgres:9.5-alpine environment: POSTGRES_USER: circleci-demo-ruby POSTGRES_DB: rails_blog_test POSTGRES_PASSWORD: "" environment: BUNDLE_JOBS: "3" BUNDLE_RETRY: "3" PGHOST: 127.0.0.1 PGUSER: circleci-demo-ruby PGPASSWORD: "" RAILS_ENV: test steps: - checkout - ruby/install-deps - node/install-packages: pkg-manager: yarn cache-key: "yarn.lock" - run: name: Wait for DB command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: Database setup command: bundle exec rails db:schema:load --trace # Run rspec in parallel - ruby/rspec-test - ruby/rubocop-check workflows: version: 2 build_and_test: jobs: - build - test: requires: - build ``` also `output/config.yaml`: ``` source_files: - repository_slug: valet-testing/unit/basic-pipeline-sample path: spec/fixtures/source_files/circle_ci/config.yml - repository_slug: valet-testing/unit/directed-acrylic-graph-pipeline path: spec/fixtures/source_files/circle_ci/config.yml ``` ________________________________ πŸš— DRY-RUN `dotnet run --project src/Valet/Valet.csproj -- dry-run circle-ci -o "output" --circle-ci-project "valet-testing/unit/basic-pipeline-sample" --config-file-path output/circle/config.yml` MIGRATE `dotnet run --project src/Valet/Valet.csproj -- migrate circle-ci -o "output" --config-file-path output/circle/config.yml ----circle-ci-project "valet-testing/unit/basic-pipeline-sample" target-url "https://github.com/begonaguereca/demo"` AUDIT `dotnet run --project src/Valet/Valet.csproj -- audit circle-ci --output-dir tmp/circle_ci/audit --config-file-path output/circle/config.yml`
Travis commands Make sure you add a sample Travis pipeline to `output/travis/pipeline.yml` ``` language: ruby os: linux dist: xenial rvm: - 2.5 - 2.2 gemfile: - gemfiles/Gemfile.rails-3.2.x - gemfiles/Gemfile.rails-3.0.x env: - ISOLATED: true - ISOLATED: false jobs: include: - rvm: 2.5 gemfile: gemfiles/Gemfile.rails-3.2.x env: - ISOLATED: false script: ./test 1 before_script: foo - stage: first stage rvm: 2.2 gemfile: gemfiles/Gemfile.rails-3.0.x env: - ISOLATED: true - stage: deploy rvm: 2.5 gemfile: gemfiles/Gemfile.rails-3.2.x deploy: provider: npm allow_failures: - rvm: 2.5 fast_finish: true script: - 'if [pull_request == false]' - 'sh hello world' before_install: - gem install bundler before_script: ./test 2 stages: - first stage - test - name: deploy if: branch = master ``` also `output/travis/config.yaml`: ``` source_files: - repository_slug: valet-testing-unit/travis-ci-nodejs-example path: output/travis/pipeline.yml - repository_slug: valet-testing-unit/travis-ci-go-example path: output/travis/pipeline.yml ``` ________________________________ πŸš— DRY-RUN `dotnet run --project src/Valet/Valet.csproj -- dry-run travis-ci -o "output" --travis-ci-repository travis-ci-nodejs-example --config-file-path output/travis/config.yml` MIGRATE `dotnet run --project src/Valet/Valet.csproj -- migrate travis-ci -o "output" --travis-ci-repository travis-ci-nodejs-example --config-file-path output/travis/config.yml --target-url "https://github.com/begonaguereca/demo"` AUDIT `dotnet run --project src/Valet/Valet.csproj -- audit travis-ci -o "output" --config-file-path output/travis/config.yml`
Jenkins commands `output/jenkins/pipeline.yml` ``` pipeline { agent { label 'labelName' kubernetes { inheritFrom "default" workspaceVolume dynamicPVC(requestsSize: "20Gi", accessModes: "ReadWriteOnce") } } stages { stage('Build') { steps { echo 'Hello world!' } } } } ``` `output/jenkins/config.yaml` ``` source_files: - repository_slug: begonaguereca/shell path: output/jenkins/Jenkinsfile - repository_slug: integration-tests/jenkinsfile/jenkinsfile-inline-elephant path: output/jenkins/Jenkinsfile ``` ________________________________ πŸš— DRY-RUN `dotnet run --project src/Valet/Valet.csproj -- dry-run jenkins -o "output" --config-file-path output/jenkins/config.yml --source-url https://jenkout.westus2.cloudapp.azure.com/job/begonaguereca/job/shell` MIGRATE `dotnet run --project src/Valet/Valet.csproj -- migrate jenkins -o "output" --config-file-path output/jenkins/config.yml --target-url "https://github.com/begonaguereca/demo" --source-url https://jenkout.westus2.cloudapp.azure.com/job/begonaguereca/job/shell` AUDIT `dotnet run --project src/Valet/Valet.csproj -- audit jenkins -o "output" --config-file-path output/jenkins/config.yml`
Gitlab commands `output/gitlab/pipeline.yml` ``` stages: - build - test image: alpine build_a: stage: build script: - echo "This job builds something." test_a: stage: test script: - echo "This job tests something. It will only run when all jobs in the" - echo "build stage are complete." ``` `output/jenkins/config.yaml`: ``` source_files: - repository_slug: valet-testing/basic-pipeline-sample path: output/gitlab/pipeline.yml - repository_slug: valet-testing/unit/directed-acrylic-graph-pipeline path: output/gitlab/pipeline.yml ``` ________________________________ πŸš— DRY-RUN `dotnet run --project src/Valet/Valet.csproj -- dry-run gitlab -o "output" --namespace valet-testing --project basic-pipeline-sample --config-file-path output/gitlab/config.yml` MIGRATE `dotnet run --project src/Valet/Valet.csproj -- migrate gitlab -o "output" --namespace valet-testing --project basic-pipeline-sample --config-file-path output/gitlab/config.yml --target-url https://github.com/begonaguereca/demo` AUDIT `dotnet run --project src/Valet/Valet.csproj -- audit gitlab -o "output" --config-file-path output/gitlab/config.yml`

How's this tested?

Closes https://github.com/github/valet/issues/5325

github-actions[bot] commented 1 year ago

Unit Test Results

38 tests  Β±0   38 :heavy_check_mark: Β±0   0s :stopwatch: Β±0s βŸβ€„1 suites Β±0β€‚β€ƒβ€ƒβŸβ€„0 :zzz: Β±0  βŸβ€„1 files   Β±0β€‚β€ƒβ€ƒβŸβ€„0 :x: Β±0 

Results for commit 67977199. ± Comparison against base commit 5a6eb028.

:recycle: This comment has been updated with latest results.