Open sunakan opened 5 years ago
circle-cliのインストール
circleci update install
でアップデート
手元でのアプデの様子
$ sudo circleci update install
You are running 0.1.5389
A new release is available (0.1.5490)
Updated to 0.1.5490
sudo付ける必要があるかどうかはインストールされてる環境次第かと
orb専用のリポジトリを用意
https://circleci.com/account/api
でcliのPersonal API Tokenの発行
circleci setup
でAPIをセットアップ
様子
$ sudo circleci setup
✔ CircleCI API Token: **█
✔ CircleCI API Token: ****************************************
✔ CircleCI Host: https://circleci.com
CircleCI host has been set.
Setup complete.
Trying an introspection query on API to verify your setup... Ok..yml.
Trying to query your username given the provided token... Hello, Sunakan.
はじめのはミス
circleci namespace create <任意の Orb のネームスペース> <VCS プロパイダ名> <CircleCI のオーガニゼーション名>
$ sudo circleci namespace create sunakan github sunakan
You are creating a namespace called "sunakan".
This is the only namespace permitted for your github organization, sunakan.
To change the namespace, you will have to contact CircleCI customer support.
✔ Are you sure you wish to create the namespace: `sunakan`: y
Namespace `sunakan` created.
Please note that any orbs you publish in this namespace are open orbs and are world-readable.
ネームスペースは今のうちとっておけ感?
1namespace1リポジトリ? 1namespaceNorbs? 1リポジトリの全てのOrb?
circleci orb publish orb.yml <Orb のネームスペース>/<任意の Orb 名>@<任意の Orb のバージョン>
エラーーーー
$ sudo circleci orb publish src/hello-world/orb.yml sunakan/hello-world@dev:test-branch
Error: the 'hello-world' orb does not exist in the 'sunakan' namespace. Did you misspell the namespace or the orb name?
1度createするって公式にあった https://circleci.com/docs/2.0/creating-orbs/#section=configuration
$ sudo circleci orb create sunakan/hello-world
You are creating an orb called "sunakan/hello-world".
You will not be able to change the name of this orb.
If you change your mind about the name, you will have to create a new orb with the new name.
✔ Are you sure you wish to create the orb: `sunakan/hello-world`: y
Orb `sunakan/hello-world` created.
Please note that any versions you publish of this orb are world-readable.
You can now register versions of `sunakan/hello-world` using `circleci orb publish`.
シンタックスチェックもできる!
$ sudo circleci orb validate src/hello-world/orb.yml
Error: ERROR IN CONFIG FILE:
[#/version] Input not a valid enum value
enum:
- '2.1'
- 2.1
orb.ymlの中に書くバージョンはCircleCIのバージョンだった
このときでは2.1
release done
$ sudo circleci orb publish src/hello-world/orb.yml sunakan/hello-world@dev:test-branch
Orb `sunakan/hello-world@dev:test-branch` was published.
Please note that this is an open orb and is world-readable.
Note that your dev label `dev:test-branch` can be overwritten by anyone in your organization.
Your dev orb will expire in 90 days unless a new version is published on the label `dev:test-branch`.
devタグでやってるため90日間放置で消える! 最高!!
devタグだと多分 https://circleci.com/orbs/registry/?query=&filterBy=all に出てこないかもしれない
version 0.0.1でリリース
$ sudo circleci orb publish src/hello-world/orb.yml sunakan/hello-world@0.0.1
Orb `sunakan/hello-world@0.0.1` was published.
Please note that this is an open orb and is world-readable.
commandを一つも書いていないので、書いて再公開する
orb便利かも
Discordの送信方法や、slack、codecoverageの送り方などが変わった時、1つのorbの変更で対応できそうherokuとかも
Tokenだけ環境変数にして、orb切り替えでリポジトリにまたがって適応されるだろうし、orbのバージョン指定で、特定の挙動とかも特定のサービス、特定のデプロイ方法、特定のビルド方法とか指定できそう
この方のが参考になるかも 今日誕生日のアイマスアイドルだすやつ
yutagoto/todays-imas-idol@1.0.0
https://circleci.com/orbs/registry/orb/yutagoto/todays-imas-idol
ゴール:自分でアップロードしたhelloworld orbを使い、結果がsuccess