jenkinsci / jenkinsci/docker

Lint docker bake file

Open
#2,143 5 comments 0 reactions 0 assignees View on GitHub
bake
Dominant language
PowerShell
Stars
7.6k
Forks
4.6k
Avg merge
1h 36m
Merged PRs (30d)
15

Description

### What feature do you want to see added?

I learnt about `hclfmt` which checks and formats HCL files.

I'd like to add it in a validation step in the pipeline, but unfortunatelly the original repo is archived since 2018: https://github.com/fatih/hclfmt

I found that this code is also now living in https://github.com/hashicorp/hcl/blob/main/cmd/hclfmt/main.go, but didn't find ay corresponding release asset.

I compiled and used it locally with success against docker bake files:
```
$ hclfmt -check -w docker-bake.hcl
```

My question is: how could I integrate it in our repos?

Other similar tools are using docker images wrapped in scripts, ex: https://github.com/jenkinsci/docker/blob/master/tools/hadolint

Should I...
- Create a docker image based on https://github.com/hashicorp/hcl/blob/main/cmd/hclfmt/main.go
- Build https://github.com/hashicorp/hcl/blob/main/cmd/hclfmt/main.go on the fly? (Would require proper go tooling in agents, and would be a bit wasteful)
- Simply include my built version in the repo?
- Find another alternative?
- Give up?

### Upstream changes

_No response_

### Are you interested in contributing this feature?

Yes.

Contributor guide

Open the contributing guide

Research direction

Start with docker-bake.hcl and the HashiCorp hclfmt entry point at cmd/hclfmt/main.go, then compare the Jenkins hadolint wrapper as an example of pipeline integration. Determine which packaging approach is appropriate for this repository and define completion as an automated validation step that checks the Docker Bake files.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.