Skip to content

Commit

Permalink
migrate github to ci-provider
Browse files Browse the repository at this point in the history
Signed-off-by: Javan lacerda <[email protected]>
  • Loading branch information
javanlacerda committed Jul 17, 2024
1 parent 18d2a37 commit e745647
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
34 changes: 31 additions & 3 deletions config/identity/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define: &github-type "github-workflow"

oidc-issuers:
https://accounts.google.com:
issuer-url: https://accounts.google.com
Expand Down Expand Up @@ -84,7 +86,8 @@ oidc-issuers:
https://token.actions.githubusercontent.com:
issuer-url: https://token.actions.githubusercontent.com
client-id: sigstore
type: github-workflow
type: ci-provider
ci-provider: *github-type
contact: [email protected]
description: "GitHub Actions OIDC auth"
meta-issuers:
Expand All @@ -102,5 +105,30 @@ meta-issuers:
type: kubernetes
https://token.actions.githubusercontent.com/*:
client-id: sigstore
type: github-workflow

type: ci-provider
ci-provider: *github-type
ci-issuer-metadata:
*github-type:
default-template-values:
url: "https://github.com"
extension-templates:
github-workflow-trigger: "event_name"
github-workflow-sha: "sha"
github-workflow-name: "workflow"
github-workflow-repository: "repository"
github-workflow-ref: "ref"
build-signer-uri: "{{ .url }}/{{ .job_workflow_ref }}"
build-signer-digest: "job_workflow_sha"
runner-environment: "runner_environment"
source-repository-uri: "{{ .url }}/{{ .repository }}"
source-repository-digest: "sha"
source-repository-ref: "ref"
source-repository-identifier: "repository_id"
source-repository-owner-uri: "{{ .url }}/{{ .repository_owner }}"
source-repository-owner-identifier: "repository_owner_id"
build-config-uri: "{{ .url }}/{{ .workflow_ref }}"
build-config-digest: "workflow_sha"
build-trigger: "event_name"
run-invocation-uri: "{{ .url }}/{{ .repository }}/actions/runs/{{ .run_id }}/attempts/{{ .run_attempt }}"
source-repository-visibility-at-signing: "repository_visibility"
subject-alternative-name-template: "{{ .url }}/{{ .job_workflow_ref }}"
7 changes: 5 additions & 2 deletions pkg/config/fulcio_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ func TestLoadFulcioConfig(t *testing.T) {
t.Errorf("expected %s, got %s", issuerURL, got.IssuerURL)
}
if string(got.Type) == "" {
t.Errorf("Issuer Type should not be empty")
t.Errorf("issuer Type should not be empty")
}
if got.Type == IssuerTypeCIProvider {
if got.CIProvider == "" {
t.Errorf("Issuer CIProvider should not be empty when Type is ci-provider")
t.Errorf("issuer that is CIProvider field shouldn't be empty when Type is ci-provider")
}
if _, ok := fulcioConfig.CIIssuerMetadata[got.CIProvider]; !ok {
t.Error("isseuer with type ci provider should has the same ci provider name as key for CIIssuerMetadata")
}
}
if _, ok := fulcioConfig.GetIssuer("not_an_issuer"); ok {
Expand Down

0 comments on commit e745647

Please sign in to comment.