Skip to content

Commit

Permalink
Add CLI integration tests for attest subcommand (#1124)
Browse files Browse the repository at this point in the history
Co-authored-by: William Woodruff <[email protected]>
  • Loading branch information
facutuesca and woodruffw authored Sep 18, 2024
1 parent 29b9233 commit 7b7b00f
Show file tree
Hide file tree
Showing 5 changed files with 605 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/assets/integration/a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DO NOT MODIFY ME!

this is "a.txt", a sample input for sigstore-python's unit tests.

DO NOT MODIFY ME!
249 changes: 249 additions & 0 deletions test/assets/integration/attest/slsa_predicate_v0_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
{
"builder": {
"id": "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v2.0.0"
},
"buildType": "https://github.com/slsa-framework/slsa-github-generator/generic@v1",
"invocation": {
"configSource": {
"uri": "git+https://github.com/sigstore/sigstore-python@refs/tags/v3.2.0",
"digest": {
"sha1": "fc29ec190575ae345cea23f0953b64ca6f2ab8ba"
},
"entryPoint": ".github/workflows/release.yml"
},
"parameters": {},
"environment": {
"github_actor": "woodruffw",
"github_actor_id": "3059210",
"github_base_ref": "",
"github_event_name": "release",
"github_event_payload": {
"action": "published",
"enterprise": {
"avatar_url": "https://avatars.githubusercontent.com/b/102459?v=4",
"created_at": "2023-12-08T05:54:26Z",
"description": "Open Source Security Foundation (OpenSSF)",
"html_url": "https://github.com/enterprises/openssf",
"id": 102459,
"name": "Open Source Security Foundation",
"node_id": "E_kgDOAAGQOw",
"slug": "openssf",
"updated_at": "2024-01-06T00:47:02Z",
"website_url": "https://openssf.org/"
},
"organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/71096353?v=4",
"description": "Software Supply Chain Security",
"events_url": "https://api.github.com/orgs/sigstore/events",
"hooks_url": "https://api.github.com/orgs/sigstore/hooks",
"id": 71096353,
"issues_url": "https://api.github.com/orgs/sigstore/issues",
"login": "sigstore",
"members_url": "https://api.github.com/orgs/sigstore/members{/member}",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjcxMDk2MzUz",
"public_members_url": "https://api.github.com/orgs/sigstore/public_members{/member}",
"repos_url": "https://api.github.com/orgs/sigstore/repos",
"url": "https://api.github.com/orgs/sigstore"
},
"release": {
"assets": [],
"assets_url": "https://api.github.com/repos/sigstore/sigstore-python/releases/170913493/assets",
"author": {
"avatar_url": "https://avatars.githubusercontent.com/u/3059210?v=4",
"events_url": "https://api.github.com/users/woodruffw/events{/privacy}",
"followers_url": "https://api.github.com/users/woodruffw/followers",
"following_url": "https://api.github.com/users/woodruffw/following{/other_user}",
"gists_url": "https://api.github.com/users/woodruffw/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/woodruffw",
"id": 3059210,
"login": "woodruffw",
"node_id": "MDQ6VXNlcjMwNTkyMTA=",
"organizations_url": "https://api.github.com/users/woodruffw/orgs",
"received_events_url": "https://api.github.com/users/woodruffw/received_events",
"repos_url": "https://api.github.com/users/woodruffw/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/woodruffw/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/woodruffw/subscriptions",
"type": "User",
"url": "https://api.github.com/users/woodruffw"
},
"body": "### Added\n\n* API: `models.Bundle.BundleType` is now a public API\n ([#1089](https://github.com/sigstore/sigstore-python/pull/1089))\n\n* CLI: The `sigstore plumbing` subcommand hierarchy has been added. This\n hierarchy is for *developer-only* interactions, such as fixing malformed\n Sigstore bundles. These subcommands are **not considered stable until\n explicitly documented as such**.\n ([#1089](https://github.com/sigstore/sigstore-python/pull/1089))\n\n### Changed\n\n* CLI: The default console logger now emits to `stderr`, rather than `stdout`\n ([#1089](https://github.com/sigstore/sigstore-python/pull/1089))\n\n",
"created_at": "2024-08-19T17:14:19Z",
"draft": false,
"html_url": "https://github.com/sigstore/sigstore-python/releases/tag/v3.2.0",
"id": 170913493,
"name": "v3.2.0",
"node_id": "RE_kwDOGq85Ts4KL-7V",
"prerelease": false,
"published_at": "2024-08-19T17:15:11Z",
"tag_name": "v3.2.0",
"tarball_url": "https://api.github.com/repos/sigstore/sigstore-python/tarball/v3.2.0",
"target_commitish": "main",
"upload_url": "https://uploads.github.com/repos/sigstore/sigstore-python/releases/170913493/assets{?name,label}",
"url": "https://api.github.com/repos/sigstore/sigstore-python/releases/170913493",
"zipball_url": "https://api.github.com/repos/sigstore/sigstore-python/zipball/v3.2.0"
},
"repository": {
"allow_forking": true,
"archive_url": "https://api.github.com/repos/sigstore/sigstore-python/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/sigstore/sigstore-python/assignees{/user}",
"blobs_url": "https://api.github.com/repos/sigstore/sigstore-python/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/sigstore/sigstore-python/branches{/branch}",
"clone_url": "https://github.com/sigstore/sigstore-python.git",
"collaborators_url": "https://api.github.com/repos/sigstore/sigstore-python/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/sigstore/sigstore-python/comments{/number}",
"commits_url": "https://api.github.com/repos/sigstore/sigstore-python/commits{/sha}",
"compare_url": "https://api.github.com/repos/sigstore/sigstore-python/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/sigstore/sigstore-python/contents/{+path}",
"contributors_url": "https://api.github.com/repos/sigstore/sigstore-python/contributors",
"created_at": "2022-01-13T17:29:37Z",
"custom_properties": {},
"default_branch": "main",
"deployments_url": "https://api.github.com/repos/sigstore/sigstore-python/deployments",
"description": "A Sigstore client written in Python",
"disabled": false,
"downloads_url": "https://api.github.com/repos/sigstore/sigstore-python/downloads",
"events_url": "https://api.github.com/repos/sigstore/sigstore-python/events",
"fork": false,
"forks": 41,
"forks_count": 41,
"forks_url": "https://api.github.com/repos/sigstore/sigstore-python/forks",
"full_name": "sigstore/sigstore-python",
"git_commits_url": "https://api.github.com/repos/sigstore/sigstore-python/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/sigstore/sigstore-python/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/sigstore/sigstore-python/git/tags{/sha}",
"git_url": "git://github.com/sigstore/sigstore-python.git",
"has_discussions": false,
"has_downloads": true,
"has_issues": true,
"has_pages": true,
"has_projects": true,
"has_wiki": false,
"homepage": "https://pypi.org/p/sigstore",
"hooks_url": "https://api.github.com/repos/sigstore/sigstore-python/hooks",
"html_url": "https://github.com/sigstore/sigstore-python",
"id": 447691086,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/sigstore/sigstore-python/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/sigstore/sigstore-python/issues/events{/number}",
"issues_url": "https://api.github.com/repos/sigstore/sigstore-python/issues{/number}",
"keys_url": "https://api.github.com/repos/sigstore/sigstore-python/keys{/key_id}",
"labels_url": "https://api.github.com/repos/sigstore/sigstore-python/labels{/name}",
"language": "Python",
"languages_url": "https://api.github.com/repos/sigstore/sigstore-python/languages",
"license": {
"key": "other",
"name": "Other",
"node_id": "MDc6TGljZW5zZTA=",
"spdx_id": "NOASSERTION",
"url": null
},
"merges_url": "https://api.github.com/repos/sigstore/sigstore-python/merges",
"milestones_url": "https://api.github.com/repos/sigstore/sigstore-python/milestones{/number}",
"mirror_url": null,
"name": "sigstore-python",
"node_id": "R_kgDOGq85Tg",
"notifications_url": "https://api.github.com/repos/sigstore/sigstore-python/notifications{?since,all,participating}",
"open_issues": 28,
"open_issues_count": 28,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/71096353?v=4",
"events_url": "https://api.github.com/users/sigstore/events{/privacy}",
"followers_url": "https://api.github.com/users/sigstore/followers",
"following_url": "https://api.github.com/users/sigstore/following{/other_user}",
"gists_url": "https://api.github.com/users/sigstore/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/sigstore",
"id": 71096353,
"login": "sigstore",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjcxMDk2MzUz",
"organizations_url": "https://api.github.com/users/sigstore/orgs",
"received_events_url": "https://api.github.com/users/sigstore/received_events",
"repos_url": "https://api.github.com/users/sigstore/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/sigstore/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sigstore/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/sigstore"
},
"private": false,
"pulls_url": "https://api.github.com/repos/sigstore/sigstore-python/pulls{/number}",
"pushed_at": "2024-08-19T17:14:57Z",
"releases_url": "https://api.github.com/repos/sigstore/sigstore-python/releases{/id}",
"size": 1835,
"ssh_url": "[email protected]:sigstore/sigstore-python.git",
"stargazers_count": 219,
"stargazers_url": "https://api.github.com/repos/sigstore/sigstore-python/stargazers",
"statuses_url": "https://api.github.com/repos/sigstore/sigstore-python/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/sigstore/sigstore-python/subscribers",
"subscription_url": "https://api.github.com/repos/sigstore/sigstore-python/subscription",
"svn_url": "https://github.com/sigstore/sigstore-python",
"tags_url": "https://api.github.com/repos/sigstore/sigstore-python/tags",
"teams_url": "https://api.github.com/repos/sigstore/sigstore-python/teams",
"topics": [
"codesigning",
"python",
"security",
"supply-chain"
],
"trees_url": "https://api.github.com/repos/sigstore/sigstore-python/git/trees{/sha}",
"updated_at": "2024-08-19T17:14:23Z",
"url": "https://api.github.com/repos/sigstore/sigstore-python",
"visibility": "public",
"watchers": 219,
"watchers_count": 219,
"web_commit_signoff_required": true
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/3059210?v=4",
"events_url": "https://api.github.com/users/woodruffw/events{/privacy}",
"followers_url": "https://api.github.com/users/woodruffw/followers",
"following_url": "https://api.github.com/users/woodruffw/following{/other_user}",
"gists_url": "https://api.github.com/users/woodruffw/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/woodruffw",
"id": 3059210,
"login": "woodruffw",
"node_id": "MDQ6VXNlcjMwNTkyMTA=",
"organizations_url": "https://api.github.com/users/woodruffw/orgs",
"received_events_url": "https://api.github.com/users/woodruffw/received_events",
"repos_url": "https://api.github.com/users/woodruffw/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/woodruffw/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/woodruffw/subscriptions",
"type": "User",
"url": "https://api.github.com/users/woodruffw"
}
},
"github_head_ref": "",
"github_ref": "refs/tags/v3.2.0",
"github_ref_type": "tag",
"github_repository_id": "447691086",
"github_repository_owner": "sigstore",
"github_repository_owner_id": "71096353",
"github_run_attempt": "1",
"github_run_id": "10457864437",
"github_run_number": "61",
"github_sha1": "fc29ec190575ae345cea23f0953b64ca6f2ab8ba"
}
},
"metadata": {
"buildInvocationId": "10457864437-1",
"completeness": {
"parameters": true,
"environment": false,
"materials": false
},
"reproducible": false
},
"materials": [
{
"uri": "git+https://github.com/sigstore/sigstore-python@refs/tags/v3.2.0",
"digest": {
"sha1": "fc29ec190575ae345cea23f0953b64ca6f2ab8ba"
}
}
]
}
36 changes: 36 additions & 0 deletions test/assets/integration/attest/slsa_predicate_v1_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"buildDefinition": {
"buildType": "https://actions.github.io/buildtypes/workflow/v1",
"externalParameters": {
"workflow": {
"ref": "refs/tags/1.21.0",
"repository": "https://github.com/octo-org/octo-repo",
"path": ".github/workflows/ci.yaml"
}
},
"internalParameters": {
"github": {
"event_name": "push",
"repository_id": "000000000",
"repository_owner_id": "0000000",
"runner_environment": "github-hosted"
}
},
"resolvedDependencies": [
{
"uri": "git+https://github.com/octo-org/octo-repo@refs/tags/1.21.0",
"digest": {
"gitCommit": "1ac93ce21ee526b36fd154b9058d97dfaa424c50"
}
}
]
},
"runDetails": {
"builder": {
"id": "https://github.com/octo-org/octo-repo/.github/workflows/docker.yaml@refs/heads/development"
},
"metadata": {
"invocationId": "https://github.com/octo-org/octo-repo/actions/runs/10313983218/attempts/2"
}
}
}
Loading

0 comments on commit 7b7b00f

Please sign in to comment.