Get an overview on this page http://tech.smarthr.jp/entry/2017/07/12/073000
Official documentation of the migration procedure https://circleci.com/docs/2.0/migrating-from-1-2/
Documentation that uses config-translation Endpoint https://circleci.com/docs/2.0/config-translation/
Suppose the build page on CircleCI is the following URL:
https://circleci.com/gh/:username/:project
In the above case, the config-translation Endpoint would be a URL like this:
Here, the branch is specified as develop
.
https://circleci.com/api/v1.1/project/github/:username/:project/config-translation?branch=develop
The file is downloaded with the file name config-translation
.
NG pattern
I set the user name of my GitHub account to : username
, and the following response result was obtained.
{
"message" : "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/#get\"}"
}
Refer to the following https://circleci.com/docs/2.0/migrating-from-1-2/
Create a .circleci
folder in the project root, move the downloaded configuration file to it, and rename the file to config.yml
.
$ mkdir .circleci
$ mv /hoge/config-translation .circleci/config.yml
Deployment
.There is no description of Deployment
in the downloaded configuration file, so you need to write it yourself.
maven integration-test
.#!/bin/bash --login
mvn integration-test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.104 s
[INFO] Finished at: 2018-04-09T04:25:24+00:00
[INFO] Final Memory: 15M/904M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/ubuntu/topgate/hogehoge/server). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
Exited with code 1
It is said that pom.xml does not exist.
pom.xml exists in /server/pom.xml
.
In 1.0
, the following description was OK.
general:
build_dir: server
In 2.0
, it is converted as follows, but since it checks out to working_directory
, it is changed to ~ / topgate / hogehoge / server / server
instead of ~ / topgate / hogehoge / server
. , pom.xml
existed, and without pom.xml
, an error occurred.
version: 2
jobs:
build:
working_directory: ~/topgate/hogehoge/server
I can think of the following two solutions.
Proposal (1) Set working_directory: ~ / topgate / hogehoge / server / server
as an option when executing the mvn command.
- run:
working_directory: ~/topgate/hogehoge/server/server
command: mvn dependency:go-offline || true
Proposal (2) Set path: ~ / topgate / hogehoge
in the checkout command and specify the next higher level folder.
- checkout:
path: ~/topgate/hogehoge
Workflows didn't work and I didn't notice the difference in the following description and got stuck.
NG pattern (filters
is in the same position as build
.)
jobs:
- build:
filters:
tags:
only: /.*/
OK pattern (filters
is the child position of build
.)
jobs:
- build:
filters:
tags:
only: /.*/
git tag
In 1.0
, in order to deploy with git tag
, the following description was made.
deployment:
prod:
tag: /release-.*/
#・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Omitted ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・
dev:
branch: develop
In 2.0
, the job does not start with git tag
, but the job starts using workflows
.
Git Tag Job Execution https://circleci.com/docs/2.0/workflows/#git-tag-job-execution
Jobs with 2.0
respond to branch changes by default, but not to tagging.
So, you need to create a filter for tag using filters
so that the job starts with tagging.
Actually, it was described as follows.
version: 2
jobs:
build:
#・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Omitted ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・
- deploy:
name: deploy to prod
command: |
if [[ "${CIRCLE_TAG}" =~ ^release-.* ]]; then
#・ ・ ・ ・ ・ ・ ・ ・ ・ Deploy command (omitted) ・ ・ ・ ・ ・ ・ ・ ・
fi
- deploy:
name: deploy to dev
command: |
if [ "${CIRCLE_BRANCH}" == "develop" ]; then
#・ ・ ・ ・ ・ ・ ・ ・ ・ Deploy command (omitted) ・ ・ ・ ・ ・ ・ ・ ・
fi
#・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Omitted ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・
workflows:
version: 2
build-deploy:
jobs:
- build:
filters:
tags:
only: /.*/
Recommended Posts