1password について
1Passwordでシークレットを管理する開発者向けのガイダンススキルです。`op` CLI、サービスアカウント、プロジェクト環境、Kubernetes連携を扱い、ローカル開発と自動化の手順を示します。
主な機能
- 01`op`によるシークレットの読み取りと注入
- 02プロジェクト環境の管理
- 03サービスアカウントによる自動化
- 04Kubernetesのシークレット同期連携
活用シーン
- 01ローカル開発コマンドへの認証情報注入
- 02CI/CDパイプラインでのシークレット利用
- 031PasswordのシークレットのKubernetes同期
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ julianobarbosa/ claude-code-skills --skill 1passwordインストール後、Claude Code で/1passwordを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
references/cli-commands.mdkubernetes-examples.mdpython-sdk.mdreferences/environments/README.mdscripts/setup-gh-plugin.shsetup-service-account.shsync-check.shtemplates/docker-compose-env.yamlenv-op-refs.templateenv.templategithub-actions-env.yamltools-python/pyproject.tomlREADME.mdtools-python/src/op_env/__init__.pyop_env_create.pyop_env_delete.pyop_env_export.pyop_env_list.pyop_env_show.pyop_env_update.pysecrets_manager.pyutils.pytools/package.jsontools/src/op-env-create.tsop-env-delete.tsop-env-export.tsop-env-list.tsop-env-show.tsop-env-update.tsutils.ts詳細
1Password
概要
このスキルでは、1Password のシークレット管理エコシステムを活用するための包括的なガイダンスを提供します。ローカル開発向けの op CLI、自動化向けのサービスアカウント、プロジェクトのシークレットを管理する Developer Environments、ネイティブの 1Password Operator や External Secrets Operator を含む Kubernetes との統合について説明します。
クイックリファレンス
コマンド構造
1Password CLI では、名詞と動詞を組み合わせた形式を使用します:op <noun> <verb> [flags]
# Authentication
op signin # Sign in to account
op signout # Sign out
op whoami # Show signed-in account info
# Secret retrieval
op read "op://vault/item/field" # Read single secret
op run -- <command> # Inject secrets as env vars
op inject -i template.env -o .env # Inject secrets into file
# Item management
op item list # List all items
op item get <item> # Get item details
op item create --category login # Create new item
op item edit <item> field=value # Edit item
op item delete <item> # Delete item
# Vault management
op vault list # List vaults
op vault get <vault> # Get vault info
op vault create <name> # Create vault
# Document management
op document list # List documents
op document get <document> # Download document
op document create <file> --vault <vault> # Upload document
ワークフローの判断ツリー
What do you need to do?
├── Retrieve a secret for local development?
│ └── Use: op read, op run, or op inject
├── Manage project environment variables?
│ └── See: Developer Environments (below)
├── Manage items/vaults in 1Password?
│ └── Use: op item, op vault, op document commands
├── Automate secrets in CI/CD?
│ └── Use: Service Accounts with OP_SERVICE_ACCOUNT_TOKEN
├── Sync secrets to Kubernetes?
│ ├── Using External Secrets Operator?
│ │ └── See: External Secrets Operator Integration
│ └── Using native 1Password Operator?
│ └── See: 1Password Kubernetes Operator
└── Configure shell plugins for CLI tools?
└── Use: op plugin commands
Developer Environments
Developer Environments では、プロジェクトのシークレットを環境変数として保存、整理、管理するための専用の場所を提供します。CLI ツールは TypeScript/Bun と Python SDK の両方のバージョンを利用できます。
機能の概要
| 機能 | GUI | TypeScript CLI | Python SDK CLI |
|---|---|---|---|
| 環境の作成 | はい | bun run create | uv run op-env-create |
| 環境の更新 | はい | bun run update | uv run op-env-update |
| 環境の削除 | はい | bun run delete | uv run op-env-delete |
| 環境の表示 | はい | bun run show | uv run op-env-show |
| 環境の一覧表示 | はい | bun run list | uv run op-env-list |
| .env へのエクスポート | はい | bun run export | uv run op-env-export |
| .env ファイルのマウント | はい(ベータ) | いいえ | いいえ |
CLI ツールのセットアップ(TypeScript)
ツールは TypeScript で記述されており、Bun ランタイムが必要です:
# Navigate to tools directory
cd tools
# Run any tool with bun
bun run src/op-env-create.ts --help
bun run src/op-env-list.ts --help
# Or use npm scripts
bun run create -- --help
bun run list -- --help
CLI ツールのセットアップ(Python SDK)
Python ツールは公式の onepassword-sdk パッケージを使用し、uv が必要です:
# Navigate to tools-python directory
cd tools-python
# Install dependencies
uv sync
# Run any tool
uv run op-env-create --help
uv run op-env-list --help
要件: Python 3.9 以降、OP_SERVICE_ACCOUNT_TOKEN 環境変数。
SDK と CLI の使い分け
| 用途 | 推奨 | 理由 |
|---|---|---|
| Python アプリケーション(FastAPI、Django) | Python SDK | ネイティブの非同期処理に対応し、サブプロセスのオーバーヘッドがありません |
| シェルスクリプト、CI/CD パイプライン | TypeScript CLI または op CLI | CLI と直接統合できます |
| シークレットの一括解決 | Python SDK | 効率的な resolve_all() が利用できます |
| タグベースのフィルタリング | TypeScript CLI | SDK はタグフィルターに対応していません |
| 対話型のローカル開発 | どちらでも | どちらも同じインターフェースを備えています |
SecretsManager(Python SDK)
実行時にシークレットを解決する必要がある Python アプリケーション向け:
from op_env.secrets_manager import SecretsManager
async def main():
sm = await SecretsManager.create()
# Single secret (with caching)
api_key = await sm.get("op://Production/API/key")
# Batch resolve
secrets = await sm.get_many([
"op://Production/DB/password",
"op://Production/DB/host",
])
# Load all vars from an environment item
env = await sm.resolve_environment("my-app-prod", "Production")
SDK の全リファレンスと統合パターンについては、references/python-sdk.md を参照してください。
環境のワークフロー
1. 環境の作成
# From inline variables
bun run src/op-env-create.ts my-app-dev Personal \
API_KEY=secret \
DB_HOST=localhost \
DB_PORT=5432
# From .env file
bun run src/op-env-create.ts my-app-prod Production --from-file .env.prod
# Combine file + inline (inline overrides file)
bun run src/op-env-create.ts azure-config Shared --from-file .env EXTRA_KEY=value
# With custom tags
bun run src/op-env-create.ts secrets DevOps --tags "env,production,api" KEY=value
2. 環境の一覧表示
# List all environments (tagged with 'environment')
bun run src/op-env-list.ts
# Filter by vault
bun run src/op-env-list.ts --vault Personal
# Filter by tags
bun run src/op-env-list.ts --tags "production"
# JSON output
bun run src/op-env-list.ts --json
3. 環境の詳細表示
# Show with masked values (default)
bun run src/op-env-show.ts my-app-dev Personal
# Show with revealed values
bun run src/op-env-show.ts my-app-dev Personal --reveal
# JSON output
bun run src/op-env-show.ts my-app-dev Personal --json
# Show only variable names
bun run src/op-env-show.ts my-app-dev Personal --keys
4. 環境の更新
# Update/add single variable
bun run src/op-env-update.ts my-app-dev Personal API_KEY=new-key
# Merge from .env file
bun run src/op-env-update.ts my-app-dev Personal --from-file .env.local
# Remove variables
bun run src/op-env-update.ts my-app-dev Personal --remove OLD_KEY,DEPRECATED
# Update and remove in one command
bun run src/op-env-update.ts my-app-dev Personal NEW_KEY=value --remove OLD_KEY
5. 環境のエクスポート
# Export to .env file (standard format)
bun run src/op-env-export.ts my-app-dev Personal > .env
# Docker-compatible format (quoted values)
bun run src/op-env-export.ts my-app-dev Personal --format docker > .env
# op:// references template (for op run/inject)
bun run src/op-env-export.ts my-app-dev Personal --format op-refs > .env.tpl
# JSON format
bun run src/op-env-export.ts my-app-dev Personal --format json
# Add prefix to all variables
bun run src/op-env-export.ts azure-config Shared --prefix AZURE_ > .env
6. 環境の削除
# Interactive deletion (asks for confirmation)
bun run src/op-env-delete.ts my-app-dev Personal
# Force delete without confirmation
bun run src/op-env-delete.ts my-app-dev Personal --force
# Archive instead of permanent delete
bun run src/op-env-delete.ts my-app-dev Personal --archive
環境シークレットの参照
シークレット参照の形式を使用して、個々の変数にアクセスします:
op://<vault>/<environment>/variables/<key>
例:
# Read single variable
op read "op://Personal/my-app-dev/variables/API_KEY"
# Use in template file (.env.tpl)
API_KEY=op://Personal/my-app-dev/variables/API_KEY
DB_HOST=op://Personal/my-app-dev/variables/DB_HOST
統合パターン
op run を使用する場合(推奨)
# 1. Export environment as op:// template
bun run src/op-env-export.ts my-app-dev Personal --format op-refs > .env.tpl
# 2. Run command with injected secrets
op run --env-file .env.tpl -- ./deploy.sh
op run --env-file .env.tpl -- docker compose up
op run --env-file .env.tpl -- npm start
op run --env-file .env.tpl -- python app.py
op inject を使用する場合
# 1. Create template with op:// references
bun run src/op-env-export.ts my-app-dev Personal --format op-refs > config.tpl
# 2. Inject secrets into file
op inject -i config.tpl -o .env
# 3. Use the generated .env file
source .env && ./app
Docker Compose を使用する場合
# 1. Export environment
bun run src/op-env-export.ts my-app-dev Personal --format op-refs > .env.tpl
# 2. Run docker compose with secrets
op run --env-file .env.tpl -- docker compose up -d
CI/CD で使用する場合(GitHub Actions)
name: Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install 1Password CLI
uses: 1password/install-cli-action@v1
- name: Load secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
API_KEY: op://CI-CD/my-app-prod/variables/API_KEY
DB_PASSWORD: op://CI-CD/my-app-prod/variables/DB_PASSWORD
- name: Deploy
run: ./deploy.sh
環境の命名
各 1Password Developer Environment には、認証情報を保持する対象にちなんだ名前を付けます。例:
<project>-azure-rg-<name>-dev、<team>-pim、<project>-github。環境の実際の一覧は、
コミット済み(公開される可能性のある)スキルファイルではなく、Git で無視されるローカルのメモに記録してください。
シークレットの取得
シークレット参照の形式
シークレットを参照する標準形式:
op://<vault>/<item>/<field>
例:
op://Development/AWS/access_key_idop://Production/Database/passwordop://Shared/API Keys/github_token
シークレットを直接読み取る
# Read a specific field
op read "op://Development/AWS/access_key_id"
# Read with JSON output
op item get "AWS" --vault Development --format json
# Read specific field from item
op item get "AWS" --vault Development --fields access_key_id
コマンドへのシークレットの挿入
op run コマンドは、シークレットを環境変数として挿入します:
# Run command with secrets
op run --env-file=.env.tpl -- ./deploy.sh
# Example .env.tpl file:
# AWS_ACCESS_KEY_ID=op://Development/AWS/access_key_id
# AWS_SECRET_ACCESS_KEY=op://Development/AWS/secret_access_key
ファイルへのシークレットの挿入
op inject コマンドは、テンプレートファイル内のシークレット参照を置き換えます:
# Inject secrets from template to output file
op inject -i config.tpl.yaml -o config.yaml
# Example config.tpl.yaml:
# database:
# host: localhost
# password: op://Production/Database/password
アイテムの管理
アイテムの作成
# Create a login item
op item create --category login \
--title "My Service" \
--vault Development \
username=admin \
password=secretpassword
# Create with generated password
op item create --category login \
--title "New Account" \
--generate-password
# Create from JSON template
op item create --template item.json
アイテムのテンプレート(JSON)
{
"title": "my-service-credentials",
"vault": {"id": "vault-uuid-or-name"},
"category": "LOGIN",
"fields": [
{"label": "username", "value": "admin", "type": "STRING"},
{"label": "password", "value": "secret", "type": "CONCEALED"},
{"label": "api_key", "value": "key123", "type": "CONCEALED"}
]
}
アイテムの編集
# Edit a field
op item edit "My Service" password=newpassword
# Add a new field
op item edit "My Service" api_key=newkey
# Edit with specific vault
op item edit "My Service" --vault Development password=newpassword
サービスアカウント
サービスアカウントを使用すると、個人の認証情報を使わずに自動化できます。
前提条件
- 1Password CLI バージョン 2.18.0 以降
- 有効な 1Password サブスクリプション
- サービスアカウントを作成するための管理者権限
サービスアカウントの作成
CLI を使用する場合:
# Create with read-only access
op service-account create "CI/CD Pipeline" \
--vault Production:read_items
# Create with write access
op service-account create "Deployment Bot" \
--vault Production:read_items,write_items
# Create with vault creation permission
op service-account create "Provisioning Bot" \
--vault Production:read_items,write_items \
--can-create-vaults
サービスアカウントの使用
サービスアカウントのトークンをエクスポートします:
export OP_SERVICE_ACCOUNT_TOKEN="ops_..."
その後、通常の CLI コマンドを使用します。コマンドはサービスアカウントで自動的に認証されます。
サービスアカウントの制限事項
- Personal、Private、Employee、またはデフォルトの Shared ボルトにはアクセスできません
- 作成後に権限を変更できません
- 1 アカウントにつき 100 個までのサービスアカウントに制限されます
- レート制限が適用されます
CI/CD との統合
GitHub Actions
name: Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install 1Password CLI
uses: 1password/install-cli-action@v1
- name: Load secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
AWS_ACCESS_KEY_ID: op://CI-CD/AWS/access_key_id
AWS_SECRET_ACCESS_KEY: op://CI-CD/AWS/secret_access_key
- name: Deploy
run: ./deploy.sh
GitLab CI
deploy:
image: 1password/op:2
variables:
OP_SERVICE_ACCOUNT_TOKEN: $OP_SERVICE_ACCOUNT_TOKEN
script:
- export AWS_ACCESS_KEY_ID=$(op read "op://CI-CD/AWS/access_key_id")
- export AWS_SECRET_ACCESS_KEY=$(op read "op://CI-CD/AWS/secret_access_key")
- ./deploy.sh
CircleCI
version: 2.1
orbs:
onepassword: onepassword/secrets@1
jobs:
deploy:
docker:
- image: cimg/base:stable
steps:
- checkout
- onepassword/exec:
command: ./deploy.sh
env:
AWS_ACCESS_KEY_ID: op://CI-CD/AWS/access_key_id
AWS_SECRET_ACCESS_KEY: op://CI-CD/AWS/secret_access_key
External Secrets Operator との統合
External Secrets Operator(ESO)は、1Password のシークレットを Kubernetes に同期します。
前提条件
- 1Password Connect Server(v1.5.6 以降)
- 認証情報ファイル(
1password-credentials.json) - 認証用のアクセストークン
- クラスターへの External Secrets Operator のインストール
Connect Server のセットアップ
# Create automation environment and get credentials
# This generates 1password-credentials.json and an access token
# Create Kubernetes secret for Connect Server credentials
kubectl create secret generic onepassword-credentials \
--from-file=1password-credentials.json
# Create secret for access token
kubectl create secret generic onepassword-token \
--from-literal=token=your-access-token
Connect Server のデプロイ
apiVersion: apps/v1
kind: Deployment
metadata:
name: onepassword-connect
spec:
replicas: 1
selector:
matchLabels:
app: onepassword-connect
template:
metadata:
labels:
app: onepassword-connect
spec:
containers:
- name: connect-api
image: 1password/connect-api:latest
ports:
- containerPort: 8080
volumeMounts:
- name: credentials
mountPath: /home/opuser/.op/1password-credentials.json
subPath: 1password-credentials.json
volumes:
- name: credentials
secret:
secretName: onepassword-credentials
---
apiVersion: v1
kind: Service
metadata:
name: onepassword-connect
spec:
selector:
app: onepassword-connect
ports:
- port: 8080
targetPort: 8080
ClusterSecretStore の設定
apiVersion: external-secrets.io/v1
kind: ClusterSecretStore
metadata:
name: onepassword
spec:
provider:
onepassword:
connectHost: http://onepassword-connect:8080
vaults:
production: 1
staging: 2
auth:
secretRef:
connectTokenSecretRef:
name: onepassword-token
namespace: external-secrets
key: token
ExternalSecret の例
基本的なシークレットの取得:
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: database-credentials
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: onepassword
target:
name: database-credentials
creationPolicy: Owner
data:
- secretKey: username
remoteRef:
key: Database # Item title in 1Password
property: username # Field label
- secretKey: password
remoteRef:
key: Database
property: password
正規表現を使用した dataFrom:
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: env-config
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: onepassword
target:
name: app-env
dataFrom:
- find:
path: app-config # Item title
name:
regexp: "^[A-Z_]+$" # Match all uppercase env vars
PushSecret(Kubernetes から 1Password へ)
apiVersion: external-secrets.io/v1alpha1
kind: PushSecret
metadata:
name: push-generated-secret
spec:
refreshInterval: 1h
secretStoreRefs:
- name: onepassword
kind: ClusterSecretStore
selector:
secret:
name: generated-credentials
data:
- match:
secretKey: api-key
remoteRef:
remoteKey: generated-api-key
property: password
metadata:
apiVersion: kubernetes.external-secrets.io/v1alpha1
kind: PushSecretMetadata
spec:
vault: production
tags:
- generated
- kubernetes
1Password Kubernetes Operator
ネイティブの 1Password Operator は、External Secrets Operator を使用せずに直接統合できます。
Helm によるインストール
helm repo add 1password https://1password.github.io/connect-helm-charts
helm install connect 1password/connect \
--set-file connect.credentials=1password-credentials.json \
--set operator.create=true \
--set operator.token.value=your-access-token
OnePasswordItem CRD
apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
name: database-secret
spec:
itemPath: "vaults/Production/items/Database"
これにより、1Password アイテムのすべてのフィールドを含む database-secret という名前の Kubernetes Secret が作成されます。
自動再起動の設定
シークレットが変更されたときにデプロイを自動的に再起動するには、次のようにします:
# Operator-level (environment variable)
AUTO_RESTART=true
# Namespace-level (annotation)
apiVersion: v1
kind: Namespace
metadata:
name: production
annotations:
operator.1password.io/auto-restart: "true"
# Deployment-level (annotation)
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
operator.1password.io/auto-restart: "true"
シェルプラグイン
シェルプラグインを使用すると、サードパーティ製 CLI の認証を自動化できます。
利用可能なプラグイン
# List available plugins
op plugin list
# Common plugins: aws, gh, stripe, vercel, fly, etc.
プラグインのセットアップ
# Initialize AWS plugin
op plugin init aws
# This configures shell aliases to use 1Password for AWS credentials
# Add to your shell profile as instructed
1Password を使った Git ワークフロー
1Password を使って、Git 操作(push、pull、clone)で使用する GitHub 認証を管理します。
クイックセットアップ
セットアップスクリプトを実行して、すべてを設定します:
./scripts/setup-gh-plugin.sh
手動セットアップ
ステップ 1:gh プラグインを初期化する
# Sign in to 1Password
op signin
# Initialize gh plugin (interactive - select your GitHub token)
op plugin init gh
ステップ 2:Git 認証情報ヘルパーを設定する
# Remove any broken credential helpers
git config --global --unset-all credential.https://github.com.helper 2>/dev/null
# Set gh as the credential helper for GitHub
git config --global credential.https://github.com.helper '!/opt/homebrew/bin/gh auth git-credential'
git config --global credential.https://gist.github.com.helper '!/opt/homebrew/bin/gh auth git-credential'
ステップ 3:シェル統合を追加する
~/.zshrc または ~/.bashrc に追加します:
# 1Password CLI plugins
source ~/.config/op/plugins.sh
仕組み
┌─────────────────────────────────────────────────────────────────┐
│ Git Push Workflow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ git push │
│ │ │
│ ▼ │
│ Git credential helper │
│ │ │
│ ▼ │
│ gh auth git-credential │
│ │ │
│ ▼ │
│ 1Password plugin (via op wrapper) │
│ │ │
│ ▼ │
│ 1Password (biometric/password unlock) │
│ │ │
│ ▼ │
│ Token retrieved and passed to git │
│ │ │
│ ▼ │
│ Push completes successfully │
│ │
└─────────────────────────────────────────────────────────────────┘
複数の GitHub アカウント
複数の GitHub アカウントを使用している場合は、リポジトリごとの認証情報を設定できます:
# For a specific repo, use a different 1Password item
cd /path/to/work-repo
git config credential.https://github.com.helper '!/opt/homebrew/bin/gh auth git-credential'
# Or use includeIf in ~/.gitconfig for path-based selection
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
よくある問題の解決方法
「Item not found in vault」エラー
これは、1Password プラグインが削除済みのトークンを参照していることを意味します:
# Remove the broken plugin configuration
rm ~/.config/op/plugins/used_items/gh.json
# Re-initialize
op plugin init gh
gh が op plugin run にエイリアス設定されている
gh を 1Password 経由で実行するようにエイリアス設定しているものの、動作しない場合:
# Check the alias
which gh # Shows: gh: aliased to op plugin run -- gh
# Run gh directly to bypass the alias
/opt/homebrew/bin/gh auth status
Git がユーザー名/パスワードを要求する
認証情報ヘルパーが設定されていることを確認します:
git config --list | grep credential
次のように表示されるはずです:
credential.https://github.com.helper=!/opt/homebrew/bin/gh auth git-credential
トラブルシューティング
よくある問題
認証に失敗する:
# Check current session
op whoami
# Sign in again
op signin
# For service accounts, verify token
echo $OP_SERVICE_ACCOUNT_TOKEN | head -c 10
アイテムが見つからない:
# List items in vault to verify name
op item list --vault "Vault Name"
# Use item ID instead of name for reliability
op item get --vault Development dh7fjsh3kd8fjs
CI/CD で権限が拒否される:
# Verify service account has access to vault
op vault list # Should show accessible vaults
# Check rate limits
op service-account ratelimit
External Secrets が同期されない:
# Check ExternalSecret status
kubectl describe externalsecret <name>
# Check Connect Server logs
kubectl logs -l app=onepassword-connect
# Verify SecretStore connection
kubectl describe secretstore <name>
ベストプラクティス
- スクリプトでボルト名やアイテム名をハードコードする代わりに、シークレット参照(
op://)を使用します - 自動化には個人アカウントよりもサービスアカウントを優先します
- 権限の範囲を最小限にし、必要なボルトへのアクセスのみを許可します
- 安定性を高めるため、スクリプトではアイテム ID を使用します(名前は変更される可能性があります)
- サインインアドレスが変更された場合は、サービスアカウントのトークンをローテーションします
- シークレットをシームレスにローテーションできるよう、Kubernetes で自動再起動を有効にします
- 環境(dev、staging、prod)ごとに別々のボルトを使用します
- 整理やフィルタリングのためにアイテムにタグを付けます
リソース
参考資料
references/cli-commands.md- CLI コマンドの完全なリファレンスreferences/kubernetes-examples.md- Kubernetes マニフェストの例references/python-sdk.md- Python SDK のリファレンスと統合ガイドreferences/environments/README.md- 開発環境ガイド
ツール
TypeScript と Python で利用できる環境管理 CLI ツール:
| 操作 | TypeScript(tools/) | Python(tools-python/) |
|---|---|---|
| 作成 | bun run create | uv run op-env-create |
| 更新 | bun run update | uv run op-env-update |
| 削除 | bun run delete | uv run op-env-delete |
| 表示 | bun run show | uv run op-env-show |
| 一覧表示 | bun run list | uv run op-env-list |
| エクスポート | bun run export | uv run op-env-export |
TypeScript の要件: Bun ランタイム
Python の要件: Python 3.9 以降、uv、OP_SERVICE_ACCOUNT_TOKEN
# TypeScript tools
cd tools && bun run src/op-env-list.ts --help
# Python SDK tools
cd tools-python && uv sync && uv run op-env-list --help
テンプレート
環境およびインテグレーションのテンプレート(templates/ 内):
| テンプレート | 説明 |
|---|---|
env.template | 標準の .env ファイルテンプレート |
env-op-refs.template | op:// 参照を含むテンプレート |
github-actions-env.yaml | GitHub Actions ワークフローの例 |
docker-compose-env.yaml | シークレット注入を含む Docker Compose |
スクリプト
scripts/setup-gh-plugin.sh- 1Password 連携を使用するよう GitHub CLI をセットアップしますscripts/setup-service-account.sh- サービスアカウントを作成して設定しますscripts/sync-check.sh- External Secrets の同期を検証します
外部ドキュメント
- 1Password CLI のドキュメント
- サービスアカウントガイド
- 開発環境
- ローカル .env ファイル
- Kubernetes Operator
- External Secrets Provider
注意点
- サービスアカウント、Connect Server、CLI の認証モードでは、レート制限、ボルトの可視性、認証情報の形式が異なります —
opを対話的に使用するスクリプトが、サービスアカウントトークンでも必ず動作するとは限りません。 op injectはレンダリング時にop://...参照を評価します — Git にコミットされたテンプレートは安全です。レンダリングされた出力が Git に触れることはありません。OP_DEVICEが設定されていない場合、CLI は生体認証プロンプトを表示します — この環境変数が設定されていない CI コンテナでは、シークレットが存在しないかのように、エラーを表示せずに失敗します。- シェルプラグイン(
op plugin init)はシェルの起動時に読み込まれます — プラグインの更新を反映するには、新しいシェルを開く必要があります。 op read op://vault/item/fieldは重複の中から最初に一致したものを返します — 同じフィールド名を持つアイテムは、作成日ではなく辞書順で解決されます。