在過去,我們團隊中的人使用的CI/CD 設定檔都是在每個專案中各自寫一份,而當有需求要調整linter版本時,每個都人要去把專案內的CI/CD 設定檔再調整一次,為了幫大家省去這個步驟,我想了一套更新linter 版本又不需要召喚大家去改設定檔的流程。
docker pull golangci/golangci-lint:v1.41.1-alpine
docker tag golangci/golangci-lint:v1.41.1-alpine ${your_image_registry}/golangci-lint:v1.41.1-alpine
docker tag golangci/golangci-lint:v1.41.1-alpine ${your_image_registry}/golangci-lint:latest
docker push ${your_image_registry}/golangci-lint:v1.41.1-alpine
docker push ${your_image_registry}/golangci-lint:latest
${your_image_registry}/golangci-lint:v1.41.1-alpine 為記錄版本用
${your_image_registry}/golangci-lint:latest 為讓大家使用
- name: golangci-lint
image: golangci/golangci-lint:v1.41.1-alpine
commands:
- golangci-lint run
- name: golangci-lint
image: ${your_image_registry}/golangci-lint:latest
commands:
- golangci-lint run
這樣就大功告成拉~
pull 你想要的版本
docker pull golangci/golangci-lint:${version}
把linter 重新上tag
docker tag golangci/golangci-lint:${version} ${your_image_registry}/golangci-lint:${version}
docker tag golangci/golangci-lint:${version} ${your_image_registry}/golangci-lint:latest
把linter image 推到你的image registry
docker push ${your_image_registry}/golangci-lint:${version}
docker push ${your_image_registry}/golangci-lint:latest
以後linter有需求要更新時就可以不用讓大家都改CI/CD Configuration了~是不是很棒呢!