{"id":13516688,"url":"https://github.com/jenkinsci/embeddable-build-status-plugin","last_synced_at":"2025-04-08T01:36:48.620Z","repository":{"id":3238197,"uuid":"4274667","full_name":"jenkinsci/embeddable-build-status-plugin","owner":"jenkinsci","description":"Embed build status of Jenkins jobs in web pages","archived":false,"fork":false,"pushed_at":"2025-03-29T09:36:25.000Z","size":807,"stargazers_count":171,"open_issues_count":15,"forks_count":260,"subscribers_count":105,"default_branch":"master","last_synced_at":"2025-04-01T00:35:16.003Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/embeddable-build-status/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-05-09T17:51:59.000Z","updated_at":"2025-03-29T09:36:28.000Z","dependencies_parsed_at":"2023-01-16T18:31:34.667Z","dependency_job_id":"534f10db-dcce-45c0-ad72-518ae3e037a8","html_url":"https://github.com/jenkinsci/embeddable-build-status-plugin","commit_stats":{"total_commits":478,"total_committers":44,"mean_commits":"10.863636363636363","dds":0.6861924686192469,"last_synced_commit":"399c050cc3fba4db46f04291940e4e345bee9d92"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fembeddable-build-status-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fembeddable-build-status-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fembeddable-build-status-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fembeddable-build-status-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/embeddable-build-status-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761051,"owners_count":20991531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-01T05:01:24.905Z","updated_at":"2025-04-08T01:36:48.603Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Embeddable Build Status Plugin\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Query Parameters](#query-parameters)\n- [Parameter Resolver](#parameter-resolver)\n- [Pipeline (DSL)](#pipeline-dsl)\n- [Text variant](#text-variant)\n- [Extension points for plugin developers](#extension-points-for-plugin-developers)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\nThis plugin provides customizable badges (similar to [shields.io](https://shields.io)) to any website.\nA [text variant](#text-variant) is also available that returns the build status as text.\n\nFor each variant there are two URLs available for inclusion:\n- **protected** exposes the badge to users having at least `Read` permission on the job:\n\n  Example: \\\n  `http://\u003cjenkinsroot\u003e/path/to/job/badge/icon?...` \u003csmall\u003e(for jobs)\u003c/small\u003e \\\n  `http://\u003cjenkinsroot\u003e/path/to/job/\u003cbuildNumber\u003e/badge/icon?...` \u003csmall\u003e\u003c/small\u003e(for builds)\n\n  If you omit any query parameter the default badge for the job/build will be returned:\n\n  ![Badge](src/doc/flat_unconfigured.svg \"Badge\")\n\n- **unprotected**  exposes the badge to users having at least `ViewStatus` permission on the job\n\n  Example: `http://\u003cjenkinsroot\u003e/buildStatus?...`\n\n  To select a specific job and build use the query parameters [job](#job) and [build](#build)\n\nCustomization can be done via query parameters.\n\n## Query Parameters\n### `style`\nFour badge types are supported by the badge variant:\n#### *plastic*\n![Badge](src/doc/plastic_unconfigured.svg \"Badge\") (default)\n\n![Customized Badge](src/doc/plastic_configured.svg \"Customized Badge\") (customized)\n\n#### *flat* (default)\n![Badge](src/doc/flat_unconfigured.svg \"Badge\") (default)\n\n![Customized Badge](src/doc/flat_configured.svg \"Customized Badge\") (customized)\n\n#### *flat-square*\n![Badge](src/doc/flat-square_unconfigured.svg \"Badge\") (default)\n\n![Customized Badge](src/doc/flat-square_configured.svg \"Customized Badge\") (customized)\n\n#### *ball-\u0026lt;size\u0026gt;*\nThis style returns the standard Jenkins \"balls\".\n\nSupported sizes are: `16x16`, `24x24`, `32x32` and `48x48` (and probably more... just try).\n\n*Examples:* `ball-16x16` or `ball-32x32`\n\n**Note:** If you are using this style **all other query parameters** will have **no effect**.\n\n### `config`\nYou can add pre-customized badge configurations via pipeline script (see **\"DSL\"** below).\n\n### `subject` and `status`\nThe customized examples above uses the following query parameters:\n\n`?subject=Custom Text\u0026status=My passing text`\n\n### `color` and `animatedOverlayColor`\n\nYou can override the color using the following valid color values:\n- one of the values: `red`, `brightgreen`, `green`, `yellowgreen`, `yellow`, `orange`, `lightgrey`, `blue`\n- a valid hexadecimal HTML RGB color \u003cstrong\u003ewithout\u003c/strong\u003e the hashtag (e.g. `FFAABB`).\n- any valid [SVG color name](https://www.december.com/html/spec/colorsvg.html)\n\n### `job`\n**Note: This parameter is only supported for the unprotected URL!**\n\nThe path for the selected job **or**\nany selector implemented via `JobSelectorExtensionPoint`\n\nIf you omit this parameter you can customize any \"untethered\" badge you like.\n\n**Important**\n\nThe job selector string **must** be URL escaped. \\\nIf you are using \u003cstrong\u003eMultibranch Pipelines\u003c/strong\u003e the \u003cstrong\u003ebranch\u003c/strong\u003e within the selector needs to be URL encoded \u003cstrong\u003etwice\u003c/strong\u003e.\n\n*Example* \\\n\u003ccode\u003e?job=path/to/job/branch/path\u003c/code\u003e \u003cstrong\u003e\u0026#10060;\u003c/strong\u003e \\\nwould become\\\n\u003ccode\u003e?job=path%2Fto%2Fjob%2Fbranch\u003cstrong\u003e%252F\u003c/strong\u003epath\u003c/code\u003e \u003cstrong\u003e\u0026#10004;\u003c/strong\u003e\n\n### `build`\n\nSelect the build.\nThis parameter is supported for the protected **and** unprotected URL!\nFor the unprotected URL use the [job](#job) parameter is also required!\n\n#### *Selectors*\nAllowed selectors are:\n\n- Build-ID (`integer`)\n- relative negative Build-Index (`0` = last, `-1` = previous, `-2` ...)\n- Selector via the following Rule:\n\n  `(last|first)[Failed|Successful|Unsuccessful|Stable|Unstable|Completed][:${params.\u003cBuildParamerName\u003e=\u003cBuildParameterValue\u003e}]`\n\n  - `(...)` is required\n  - `[...]` is optional\n\n  Examples:\n  - `last`\n  - `first`\n  - `lastStable`\n  - `firstCompleted`\n  - `lastSuccessful:${params.BRANCH=master}`\n\n#### *Concatenation*\n\nAll those selectors can be concatenated as comma separated list:\n\n`build=last,-10,firstSuccessful:${params.BRANCH=master}`\n\nThis searches in the last `10` runs for the first successful build of the `master` branch (provided the Build Parameter `BRANCH` exists).\n\n**Note:** If you are using \u003cstrong\u003eMultibranch Pipelines\u003c/strong\u003e the \u003cstrong\u003ebranch name\u003c/strong\u003e within the selector needs to be URL encoded twice (see [job](#job) for further information).\n\n### `link`\n\nProvide a link to be opened on clicking on the badge.\n\n## Parameter Resolver\n\nThe query parameters `subject`, `status`, `color`, `animatedOverlayColor` and `link` support the usage of variables like `?subject=Build ${variable}`\n\nAvailable builtin variables are:\n - `buildId`, `buildNumber`, `displayName`, `description`, `duration`, and `startTime`\n - `params.\u003cBuildParameterName\u003e` where `\u003cBuildParameterName\u003e` matches any Parameter used for running the job.\n\n   **Note:** If the build parameter is not set you can use the following syntax to use a fallback value:\n   `params.\u003cBuildParameterName\u003e|\u003cFallbackValue\u003e`\n\nExample: `?subject=Build ${params.BUILD_BRANCH|master} (${displayName})`\n\n## Pipeline (DSL)\n\n```groovy\n/**\n * Adds a badge configuration with the given id.\n * minimal params\n *\n * id: A unique id for the configuration\n */\naddEmbeddableBadgeConfiguration(id: \u003cid\u003e)\n\n/**\n * all params\n *\n * id: A unique id for the configuration\n * subject: A subject text\n * status: A status text\n * color: A valid color (RGB-HEX: RRGGBB or valid SVG color name)\n * animatedOverlayColor: A valid color (RGB-HEX: RRGGBB or valid SVG color name)\n * link: The link to be opened upon clicking.\n */\naddEmbeddableBadgeConfiguration(id: \u003cstring\u003e,\n                                subject: \u003cstring\u003e,\n                                status: \u003cstring\u003e,\n                                color: \u003cstring\u003e,\n                                animatedOverlayColor: \u003cstring\u003e,\n                                link: \u003cstring\u003e)\n```\n\nThis function returns a configuration object.\n\n### Example\n\n```groovy\ndef win32BuildBadge = addEmbeddableBadgeConfiguration(id: \"win32build\", subject: \"Windows Build\")\n\ndef RunBuild() {\n    echo 'Sleeping instead of running the build'\n    sleep 10\n}\n\npipeline {\n    agent any\n    stages {\n        stage('Building') {\n            steps {\n                script {\n                    win32BuildBadge.setStatus('running')\n                    try {\n                        RunBuild()\n                        win32BuildBadge.setStatus('passing')\n                    } catch (Exception err) {\n                        win32BuildBadge.setStatus('failing')\n\n                        /* Note: If you do not set the color\n                                 the configuration uses the best status-matching color.\n                                 passing -\u003e brightgreen\n                                 failing -\u003e red\n                                 ...\n                        */\n                        win32BuildBadge.setColor('pink')\n                        error 'Build failed'\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nYou can use the `config` query parameter to reference the `win32build` id:\n\n`http://\u003cjenkinsroot\u003e/path/to/job/\u003cbuildNumber\u003e/badge/icon?config=win32build`\n\n`http://\u003cjenkinsroot\u003e/buildStatus/icon?job=...\u0026build=...\u0026config=win32build`\n\n![Passing](src/doc/config_example_1.svg \"Passing\")\n![Failing](src/doc/config_example_2.svg \"Failing\")\n\n## Text variant\n\nThe text variant returns a string representing the build status.\nBuild status strings returned by the text variant include:\n\n* `Success` - the build succeeded\n* `Failed` - the build failed\n* `Unstable` - the build succeeded but one or more tests failed\n* `Aborted` - the build was canceled\n* `Not built` - the build has not yet run\n\nMore details of the valid build results are available in the [Jenkins javadoc](https://javadoc.jenkins-ci.org/hudson/model/Result.html#field.summary).\n\n## Extension points for plugin developers\n\nA [Jenkins Extension annotation](https://www.jenkins.io/doc/developer/extensibility/#extension-annotation) allows Jenkins to discover classes, instantiate them, and register them in global lists of implementations of their supertypes and interfaces.\nThe plugin provides several extension points that plugin developers can use to extend the behavior of the plugin.\nThe Jenkins developer documentation provides more details on [extensions](https://www.jenkins.io/doc/developer/extensions/) and how to use them.\n\n### `JobSelectorExtensionPoint`\n\nThe [`JobSelectorExtensionPoint`](https://javadoc.jenkins-ci.org/plugin/embeddable-build-status/org/jenkinsci/plugins/badge/extensionpoints/JobSelectorExtensionPoint.html) allows custom job selector implementations.\n\n### `RunSelectorExtensionPoint`\n\nThe [`RunSelectorExtensionPoint`](https://javadoc.jenkins-ci.org/plugin/embeddable-build-status/org/jenkinsci/plugins/badge/extensionpoints/RunSelectorExtensionPoint.html) allows custom run selector implementations.\n\n### `ParameterResolverExtensionPoint`\n\nThe [`ParameterResolverExtensionPoint`](https://javadoc.jenkins-ci.org/plugin/embeddable-build-status/org/jenkinsci/plugins/badge/extensionpoints/ParameterResolverExtensionPoint.html) allow custom `${\u003cParameter\u003e}` resolver implementations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fembeddable-build-status-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fembeddable-build-status-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fembeddable-build-status-plugin/lists"}