ソース追跡で特定された変更のリリースと取得
このプロセスは反復的なプロセスです。最初にリモートとローカルの変更をプレビューします。競合が存在する場合は解決します。これらの変更が組織とローカルプロジェクトの両方に存在していることを確認する必要があります。このため、リモートの変更をローカルプロジェクトで取得し、それをソース制御リポジトリに転送することで、ソース制御システムはすべての変更を保存している、履歴の情報源となります。Apex コードなどのローカルの変更を組織にリリースすると、その変更を検証およびテストできるようなります。Salesforce アプリケーションの開発が終了するまでこのプロセスを反復し続けます。
ソース追跡の実例をいくつか見てみましょう。
project retrieve preview を実行し、リモートの変更を確認した場合は次のようになります。
1sf project retrieve preview --target-org DevSandbox
2
3No conflicts found.
4
5No files will be deleted.
6
7Will Retrieve [3] files.
8 Type Fullname Path
9 ──────────── ───────────────────────────────── ────
10 Layout GizmoObject__c-GizmoObject Layout
11 CustomObject GizmoObject__c
12 ApexClass GizmoClass
13
14Ignored [2] files. These files won't retrieve because they're ignored by your .forceignore file.
15 Type Fullname Path
16 ─────── ─────────────────────────────────── ────
17 Profile Admin
18 Profile B2B Reordering Portal Buyer Profileproject retrieve start コマンドにより、組織内の変更をローカルプロジェクトに取得します。コンポーネントがローカルに作成されたので、Path 列に値が入力され、デフォルトのパッケージディレクトリが表示されています。
1sf project retrieve start --target-org DevSandbox
2Preparing retrieve request... ⣟ Sending request to org
3Preparing retrieve request... Succeeded
4
5Retrieved Source
6=========================================================================================================================================
7| State Name Type Path
8| ─────── ───────────────────────────────── ──────────── ────────────────────────────────────────────────────────────────────────────────
9| Created GizmoClass ApexClass force-app/main/default/classes/GizmoClass.cls
10| Created GizmoClass ApexClass force-app/main/default/classes/GizmoClass.cls-meta.xml
11| Created GizmoObject__c CustomObject force-app/main/default/objects/GizmoObject__c/GizmoObject__c.object-meta.xml
12| Created GizmoObject__c-GizmoObject Layout Layout force-app/main/default/layouts/GizmoObject__c-GizmoObject Layout.layout-meta.xmlソースを取得した後に、project retrieve preview を再度実行します。今度は、取得できるものはないとソース追跡が報告しています。
1sf project retrieve preview
2
3No conflicts found.
4
5No files will be deleted.
6
7No files will be retrieved.
8
9Ignored [2] files. These files won't retrieve because they're ignored by your .forceignore file.
10 Type Fullname Path
11 ─────── ─────────────────────────────────── ────
12 Profile Admin
13 Profile B2B Reordering Portal Buyer Profile次に、リリースについて見てみましょう。ローカルの変更をプレビューするには、project deploy preview を実行します。
1sf project deploy preview --target-org DevSandbox
2
3No conflicts found.
4
5No files will be deleted.
6
7Will Deploy [2] files.
8 Type Fullname Path
9 ──────────── ─────────────── ──────────────────────────────────────────────────────────────────────────────
10 ApexClass WidgetClass force-app/main/default/classes/WidgetClass.cls-meta.xml
11 CustomObject WidgetObject__c force-app/main/default/objects/WidgetObject__c/WidgetObject__c.object-meta.xml
12
13No files were ignored. Update your .forceignore file if you want to ignore certain files.ローカルの変更をリリースします。Sandbox にリリースすると、Sandbox を使用している他の開発者から変更を参照できるようになります。
1sf project deploy start --target-org DevSandbox
2Deploying v59.0 metadata to test-ikspctiorkzs@example.com using the v59.0 SOAP API.
3Deploy ID: 0Af8D00000pNmKySAK
4Status: Succeeded | ████████████████████████████████████████ | 2/2 Components (Errors:0) | 0/0 Tests (Errors:0)
5
6Deployed Source
7=====================================================================================================================
8| State Name Type Path
9| ─────── ─────────────── ──────────── ──────────────────────────────────────────────────────────────────────────────
10| Created WidgetClass ApexClass force-app/main/default/classes/WidgetClass.cls
11| Created WidgetClass ApexClass force-app/main/default/classes/WidgetClass.cls-meta.xml
12| Created WidgetObject__c CustomObject force-app/main/default/objects/WidgetObject__c/WidgetObject__c.object-meta.xmlproject deploy preview を再度実行します。
1sf project deploy preview
2
3No conflicts found.
4
5No files will be deleted.
6
7No files will be deployed.
8
9No files were ignored. Update your .forceignore file if you want to ignore certain files.コマンドからリリースするものがないと報告されます。これは、ローカルプロジェクトと組織が同期されていることを意味します。