Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Update GitHub Action to build Docker container #181

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

xnyo
Copy link
Member

@xnyo xnyo commented Apr 2, 2024

Updates the GitHub Action test.yml so it builds the Docker container, rather than running the tests and build step directly inside GitHub Actions.

Right now, the GitHub Action is doing the same steps as the ones in the Dockerfile:

FROM golang:1.21-alpine as builder
WORKDIR /go/src/github.com/grafana/plugin-validator
ADD . /go/src/github.com/grafana/plugin-validator
RUN apk add --no-cache git ca-certificates curl && \
update-ca-certificates
RUN git clone https://github.com/magefile/mage --depth 1 && \
cd mage && \
go run bootstrap.go && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
RUN cd /go/src/github.com/grafana/plugin-validator && \
mage -v build:ci && \
ls -al bin

With this PR, the GH action will trigger a Docker image build. This is better because whenever we change the build/test steps (or the golangci-lint, semgrep or gosec versions), we don't have to update the GH action workflow as well as the Dockerfile.

This is also the same approach used in the drone pipeline, where the "build + test + push" step simply builds the Docker container:

steps:
- image: plugins/docker
name: build + test + push
settings:
dry_run: true
password:
from_secret: docker-hub-password
repo: grafana/plugin-validator-cli
tags: latest
username:
from_secret: docker-hub-username

@xnyo xnyo requested review from a team as code owners April 2, 2024 10:07
@xnyo xnyo requested review from sunker, wbrowne, andresmgot, oshirohugo and briangann and removed request for a team April 2, 2024 10:07
@xnyo xnyo self-assigned this Apr 2, 2024
@xnyo xnyo added enhancement New feature or request github_actions Pull requests that update GitHub Actions code labels Apr 2, 2024
@xnyo xnyo merged commit cb55801 into main Apr 5, 2024
3 checks passed
@xnyo xnyo deleted the giuseppe/gh-action-build-docker branch April 5, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request github_actions Pull requests that update GitHub Actions code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants