Skip to content

Commit 9f02ba2

Browse files
authored
Migrate github to ci provider flow (#1738)
Contribute towards #1111 Moves GitHub configuration to the new ci-provider configuration. No changes to issued certificates. Signed-off-by: Javan Lacerda <javanlacerda@google.com>
1 parent 7cb695f commit 9f02ba2

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

config/identity/config.yaml

+31-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
define: &github-type "github-workflow"
16+
1517
oidc-issuers:
1618
https://accounts.google.com:
1719
issuer-url: https://accounts.google.com
@@ -90,7 +92,8 @@ oidc-issuers:
9092
https://token.actions.githubusercontent.com:
9193
issuer-url: https://token.actions.githubusercontent.com
9294
client-id: sigstore
93-
type: github-workflow
95+
type: ci-provider
96+
ci-provider: *github-type
9497
contact: tac@sigstore.dev
9598
description: "GitHub Actions OIDC auth"
9699
meta-issuers:
@@ -108,5 +111,30 @@ meta-issuers:
108111
type: kubernetes
109112
https://token.actions.githubusercontent.com/*:
110113
client-id: sigstore
111-
type: github-workflow
112-
114+
type: ci-provider
115+
ci-provider: *github-type
116+
ci-issuer-metadata:
117+
*github-type:
118+
default-template-values:
119+
url: "https://github.com"
120+
extension-templates:
121+
github-workflow-trigger: "event_name"
122+
github-workflow-sha: "sha"
123+
github-workflow-name: "workflow"
124+
github-workflow-repository: "repository"
125+
github-workflow-ref: "ref"
126+
build-signer-uri: "{{ .url }}/{{ .job_workflow_ref }}"
127+
build-signer-digest: "job_workflow_sha"
128+
runner-environment: "runner_environment"
129+
source-repository-uri: "{{ .url }}/{{ .repository }}"
130+
source-repository-digest: "sha"
131+
source-repository-ref: "ref"
132+
source-repository-identifier: "repository_id"
133+
source-repository-owner-uri: "{{ .url }}/{{ .repository_owner }}"
134+
source-repository-owner-identifier: "repository_owner_id"
135+
build-config-uri: "{{ .url }}/{{ .workflow_ref }}"
136+
build-config-digest: "workflow_sha"
137+
build-trigger: "event_name"
138+
run-invocation-uri: "{{ .url }}/{{ .repository }}/actions/runs/{{ .run_id }}/attempts/{{ .run_attempt }}"
139+
source-repository-visibility-at-signing: "repository_visibility"
140+
subject-alternative-name-template: "{{ .url }}/{{ .job_workflow_ref }}"

pkg/config/fulcio_config_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ func TestLoadFulcioConfig(t *testing.T) {
5353
t.Errorf("expected %s, got %s", issuerURL, got.IssuerURL)
5454
}
5555
if string(got.Type) == "" {
56-
t.Errorf("Issuer Type should not be empty")
56+
t.Errorf("issuer Type should not be empty")
5757
}
5858
if got.Type == IssuerTypeCIProvider {
5959
if got.CIProvider == "" {
60-
t.Errorf("Issuer CIProvider should not be empty when Type is ci-provider")
60+
t.Errorf("issuer that is CIProvider field shouldn't be empty when Type is ci-provider")
61+
}
62+
if _, ok := fulcioConfig.CIIssuerMetadata[got.CIProvider]; !ok {
63+
t.Error("issuer with type ci-provider should have the same CI provider name as key for CIIssuerMetadata")
6164
}
6265
}
6366
if _, ok := fulcioConfig.GetIssuer("not_an_issuer"); ok {

0 commit comments

Comments
 (0)