Please tell me how to modify the config.yml file to CircleCI 1.0→2.0.

Asked 2 years ago, Updated 2 years ago, 109 views

The config.yml of CircleCI 1.0 is as follows, and I would like to create a conversion tool for 2.0, but the version is now 2.0, but

Commitments are not reflected in the development environment and production. Where should I modify them?

[CircleCI 1.0 config.yml]

 machine:
  timezone:
    Asia/Tokyo
  ruby:
    version —x.x.2

  php:
    version —x.x.15

  hosts:
    dev.example.com: xxx.0.0.1

test:
  override:
    - exit0

deployment:
  production:
    branch —Master
    commands:
      - bundle exec cap production deploy
  staging:
    branch:develop
    commands:
      - bundle exec cap development deploy

[CircleCI 2.0 config.yml] This is not reflected in the site (CircleCI 2.0 error does not appear)

version:2
jobs:
  build:
    working_directory: ~/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    parallelism:1
    shell: /bin/bash --login

    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results

    docker:
    - image:circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
      command: /sbin/init
    Steps:

    - run:
        working_directory: ~/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        command: 'echo' 'Asia/Tokyo' | sudo tee-a/etc/timezone; sudo dpkg-reconfigure
          - f noninteractive tzdata; sudo service mysql restart; sudo service postgresql
          restart;'
    - run:
        working_directory: ~/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        command: rm-f to /xxxxxxxxxxx/xxxxxxxxxxxxx.rvmrc;echo 2.1.2>~/xxxxxxxxxxx/xxxxxxxxxxx.ruby-version;rvm use 2.1.2 --default
    - run:
        working_directory: ~/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        command: |-
          ln-fs<<$HOME/.phpenv/versions/x.x.15/libexec/apache2/libphp5.so/usr/lib/apache2/modules/libphp5.so
          phpenv global x.x.152>/dev/null
    - run:
        working_directory: ~/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        command: |-
          printf'xxx.0.0.1 dev.example.com
          ' | sudo tee-a/etc/hosts

    - restore_cache:
        keys:

        - v1-dep-

    - run —composer install --no-interaction
    - run —echo-e "exportRAILS_ENV=test\nexport RACK_ENV=test">>$BASH_ENV
    - run: 'bundle check --path=vendor/bundle||bundle install --path=vendor/bundle
        --jobs=4 --retry=3'

    - save_cache:
        key —v1-dep-{{.Branch}}-{epoch}}
        paths:

        - vendor/bundle
        - ~/virtualenvs
        - ~ of .m2
        - ~/.ivy2
        - ~/.bundle
        - ~/.go_workspace
        - ~/.gradle
        - ~/.cache/bower

    - run —Exit 0

    - store_test_results:
        path —/tmp/circleci-test-results

    - store_artifacts:
        path: /tmp/circleci-artifacts
    - store_artifacts:
        path —/tmp/circleci-test-results

circleci

2022-09-30 19:30

1 Answers

This is due to a missing deployment part that was running on CI 1.0.

The affected areas are as follows:

deployment:
  production:
    branch —Master
    commands:
      - bundle exec cap production deploy
  staging:
    branch:develop
    commands:
      - bundle exec cap development deploy

This bundle exec cap environment deploy is the command you are actually deploying to the site.This does not exist in CircleCI 2.0, so I think it is not reflected.

Additional note 2019-03-25T17:37:09+09:00

Therefore, you must deploy for CircleCI 2.0. Unlike run, the deploy command provides more parallelism, so use this to add a deployment mechanism.

ConfiguringCircleCI-CircleCI

The contents of CircleCI 1.0 and CircleCI 2.0 are very different, so it is difficult to answer how to correct them, but if you insert the following contents into the modified steps such as build, you will be able to deploy them.

-deploy:
    command: |
        bundle exec cap development deploy


2022-09-30 19:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.