summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/rules/latest.md
blob: 1b20432d653b31e0ee7e0d43c671541062a19a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# latest

The `latest` rule checks that module arguments like those used for source
control checkout do not have arguments that might generate different results
based on context.

This more generic rule replaced two older rules named `git-latest` and
`hg-latest`.

We are aware that there are genuine cases where getting the tip of the main
branch is not accidental. For these cases, just add a comment such as
`# noqa: latest` to the same line to prevent it from triggering.

## Possible errors messages:

- `latest[git]`
- `latest[hg]`

## Problematic code

```yaml
---
- name: Example for `latest` rule
  hosts: localhost
  tasks:
    - name: Risky use of git module
      ansible.builtin.git:
        repo: "https://github.com/ansible/ansible-lint"
        version: HEAD # <-- HEAD value is triggering the rule
```

## Correct code

```yaml
---
- name: Example for `latest` rule
  hosts: localhost
  tasks:
    - name: Safe use of git module
      ansible.builtin.git:
        repo: "https://github.com/ansible/ansible-lint"
        version: abcd1234... # <-- that is safe
```