require-bitbucket-pipelines-image-pinned-tag
Require pinned (non-latest) Docker image tags in Bitbucket Pipelines.
Targeted pattern scopeâ
This rule reads bitbucket-pipelines.yml and checks every image: entry for an
explicit, non-latest version tag.
What this rule reportsâ
This rule reports image: entries that either have no tag at all (implicitly
pulling latest) or explicitly use the :latest tag.
Why this rule existsâ
Using unpinned or :latest Docker images in CI makes builds non-reproducible.
The same pipeline run with the same code may produce different results if the image
was updated upstream, leading to mysterious failures that are difficult to debug and
bisect. Pinning to an explicit tag (e.g. node:20.11-alpine) ensures that the
exact same environment is used every time, making failures consistent and traceable.
â Incorrectâ
# bitbucket-pipelines.yml â unpinned image
image: node
pipelines:
default:
- step:
script:
- npm test
# bitbucket-pipelines.yml â explicit latest tag
image: node:latest
â Correctâ
# bitbucket-pipelines.yml
image: node:20.11-alpine
pipelines:
default:
- step:
script:
- npm test
ESLint flat config exampleâ
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.bitbucket,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-bitbucket-pipelines-image-pinned-tag": "error",
},
},
];
When not to use itâ
Disable this rule if your organisation manages image freshness through a dedicated image pipeline and intentionally runs against a floating tag.
Rule catalog ID: R058