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

feat: Move main.go into root for direct install. #68

Merged
merged 3 commits into from
Jul 8, 2023

Conversation

mdjward
Copy link
Contributor

@mdjward mdjward commented Jun 5, 2023

Motivation

TL;DR: make it easier to run go install github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION}

Docker Hub rate limiting makes repeatedly pulling the Golang image to build this action from GitHub actions problematic.

In my use case, a private registry and cache for the action runners is already available, to which I'm storing the amd64 build of the following:

# syntax=docker/dockerfile:1

FROM golang:1.16-alpine AS go

ARG GATEKEEPER_VERSION="1.2.1"

RUN apk add --no-cache git \
    && go get github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION} \
    && cd ${GOPATH}/pkg/mod/github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION} \
    && GO111MODULE=on LANG=en_US.UTF-8 CGO_ENABLED=0 go build ./cmd/merge-gatekeeper \
    && mv merge-gatekeeper /go/bin

FROM alpine:3.17 AS alpine

COPY --from=go /go/bin/merge-gatekeeper /usr/local/bin/merge-gatekeeper

ENTRYPOINT ["/usr/local/bin/merge-gatekeeper"]

Using go install would simplify this a lot.

Changes

  1. Moved main.go and version.txt into the repository root.
  2. Updated version.txt to the latest tagged version of your repo.

Side note: propose leveraging Actions and a Semantic release tool (example) to automate version changes.

I'm keen to contribute other changes in line with my use-case, but this one is pretty fundamental to my use case. Thanks in advance!

Copy link
Contributor

@rytswd rytswd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the really delayed review, and thanks for the contribution! 🥰

Just to give you some context... we originally had an idea of adding more processes with Merge Gatekeeper, such as check for specific label being applied, add extra biz side reviewer to participate for sign-off, etc. - all of those meant to be "gatekeeping premature merges". But we would probably be better off creating a completely separate action for those, as the main logic we currently have is enough for the gatekeeping aspect, and anything more involved could be a separate / additional item.

LGTM!

@rytswd
Copy link
Contributor

rytswd commented Jul 8, 2023

Side note: propose leveraging Actions and a Semantic release tool (example) to automate version changes.

Thanks for the note, and we understand that the current setup is quite manual and error prone. We are absolutely open to ideas!

In the meantime, I'm getting this change merged 🥰

@rytswd rytswd merged commit 9dc4824 into upsidr:main Jul 8, 2023
@mdjward mdjward deleted the feat/go-installable-package branch November 9, 2023 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants