Skip to content

Commit

Permalink
Update: Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CaffeeLake committed Jan 6, 2023
1 parent b528334 commit 5317a90
Show file tree
Hide file tree
Showing 21 changed files with 228 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .envrc
@@ -1 +1 @@
export GO111MODULE=on
dotenv
16 changes: 16 additions & 0 deletions .github/workflows/actionlint.yml
@@ -0,0 +1,16 @@
name: Actionlint

on:
push:
paths:
- .github/workflows/*
pull_request:
paths:
- .github/workflows/*

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-actionlint@v1
22 changes: 8 additions & 14 deletions .github/workflows/docker-publish.yml
@@ -1,36 +1,32 @@
name: Docker Publish

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
workflow_dispatch:
push:
branches:
- main

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# https://github.com/docker/setup-buildx-action
- name: Setup Docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
Expand All @@ -43,8 +39,6 @@ jobs:
github_repo="${{ github.repository }}"
echo "DOCKER_REPO=${github_repo,,}" >> "${GITHUB_ENV}"
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
Expand All @@ -55,13 +49,13 @@ jobs:
type=ref,event=branch
type=sha,format=long
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
push: true
file: Dockerfile
target: production
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -10,16 +10,20 @@

# Test binary, built with `go test -c`
*.test
coverage

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor

# Go workspace file
go.work

# local env files
*.env

mischan-bot
mischan.yaml
telepresence.log
42 changes: 29 additions & 13 deletions Dockerfile
@@ -1,21 +1,37 @@
ARG go_version=1.19
ARG kustomize_version=v4.5.7

FROM golang:${go_version} as tools
# development
FROM golang:${go_version} AS development

ENV GO111MODULE=on
ENV CGO_ENABLED=0
RUN go install sigs.k8s.io/kustomize/kustomize/v4@v4.5.5
RUN go install sigs.k8s.io/kustomize/kustomize/v4@${kustomize_version}

FROM golang:${go_version} as builder
COPY . /mischan-bot

COPY . /work
ENV GO111MODULE=on
ENV CGO_ENABLED=0
RUN cd /work && go build -o /mischan-bot
WORKDIR /mischan-bot

FROM gcr.io/distroless/static:debug
CMD go mod download \
&& GO111MODULE=on go run main.go

COPY --from=tools /go/bin/kustomize /bin
COPY --from=builder /mischan-bot /bin
# workspace
FROM golang:${go_version} AS workspace

ENTRYPOINT [ "/bin/mischan-bot" ]
RUN go install sigs.k8s.io/kustomize/kustomize/v4@${kustomize_version}

COPY . /mischan-bot

WORKDIR /mischan-bot

RUN go mod download \
&& GO111MODULE=on go build -buildmode pie -o /mischan-bot/mischan-bot

# production
FROM gcr.io/distroless/base:debug AS production

RUN ["/busybox/sh", "-c", "ln -s /busybox/sh /bin/sh"]
RUN ["/busybox/sh", "-c", "ln -s /bin/env /usr/bin/env"]

COPY --from=workspace /mischan-bot/mischan-bot /bin/mischan-bot
COPY --from=workspace /go/bin/kustomize /bin/kustomize

ENTRYPOINT ["/bin/mischan-bot"]
3 changes: 2 additions & 1 deletion LICENSE
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 MISW
Copyright (c) 2020-2023, MIS.W(早稲田大学経営情報学会)
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 5 additions & 3 deletions README.md
@@ -1,8 +1,10 @@
## mischan-bot
GitOpsで利用するためのGitHub App

実際にMISWのクラスタにて利用されています
GitOps で利用するための GitHub App

過去に MISW の k8s クラスタにて利用されていました。

## License
- Copyright (c) 2020 MISW

- Copyright (c) 2020-2023, MIS.W(早稲田大学経営情報学会) All rights reserved.
- Under the MIT License
14 changes: 0 additions & 14 deletions dev.Dockerfile

This file was deleted.

58 changes: 31 additions & 27 deletions go.mod
Expand Up @@ -3,44 +3,48 @@ module github.com/MISW/mischan-bot
go 1.19

require (
github.com/bradleyfalzon/ghinstallation/v2 v2.0.4
github.com/go-git/go-git/v5 v5.4.2
github.com/google/go-github/v45 v45.2.0
github.com/bradleyfalzon/ghinstallation/v2 v2.1.0
github.com/go-git/go-git/v5 v5.5.1
github.com/google/go-github/v49 v49.0.0
github.com/heetch/confita v0.10.0
github.com/labstack/echo/v4 v4.9.0
go.uber.org/dig v1.14.1
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f
github.com/labstack/echo/v4 v4.10.0
go.uber.org/dig v1.16.0
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
)

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/cloudflare/circl v1.3.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-billy/v5 v5.4.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.0.0 // indirect
github.com/google/go-github/v41 v41.0.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/google/go-github/v45 v45.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/labstack/gommon v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/pjbgf/sha1cd v0.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.5.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

0 comments on commit 5317a90

Please sign in to comment.