Skip to content

Commit 6b3f9e7

Browse files
committed
Initial commit: just collect data to stdout
0 parents  commit 6b3f9e7

File tree

10 files changed

+406
-0
lines changed

10 files changed

+406
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git
2+
.gitignore
3+
.github
4+
.dockerignore
5+
Dockerfile
6+
.gitlab-ci.yml
7+
vendor

.github/workflows/release.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Release
7+
8+
jobs:
9+
build:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Set up Go 1.14.2
15+
uses: actions/setup-go@v1
16+
with:
17+
go-version: 1.14.2
18+
id: go
19+
20+
- name: Checkout code
21+
uses: actions/checkout@master
22+
23+
- name: build linux
24+
run: GOOS=linux go build -a -v -installsuffix cgo -ldflags="-w -s" -o gitlab-system-hooks-linux .
25+
26+
- name: build darwin
27+
run: GOOS=darwin go build -a -v -installsuffix cgo -ldflags="-w -s" -o gitlab-system-hooks-darwin .
28+
29+
- name: Create Release
30+
id: create_release
31+
uses: actions/create-release@v1.0.0
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
with:
35+
tag_name: ${{ github.ref }}
36+
release_name: Release ${{ github.ref }}
37+
draft: false
38+
prerelease: false
39+
40+
- name: save linux artifact in Actions
41+
uses: actions/upload-artifact@v1.0.0
42+
with:
43+
name: linux
44+
path: gitlab-system-hooks-linux
45+
46+
- name: save darwin artifact in Actions
47+
uses: actions/upload-artifact@v1.0.0
48+
with:
49+
name: darwin
50+
path: gitlab-system-hooks-darwin
51+
52+
- name: upload linux release asset
53+
uses: actions/upload-release-asset@v1.0.1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
upload_url: ${{ steps.create_release.outputs.upload_url }}
58+
asset_path: ./gitlab-system-hooks-linux
59+
asset_name: gitlab-system-hooks-linux
60+
asset_content_type: application/binary
61+
62+
- name: upload darwin release asset
63+
uses: actions/upload-release-asset@v1.0.1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
upload_url: ${{ steps.create_release.outputs.upload_url }}
68+
asset_path: ./gitlab-system-hooks-darwin
69+
asset_name: gitlab-system-hooks-darwin
70+
asset_content_type: application/binary
71+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+

.gitlab-ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
stages:
2+
- build
3+
4+
variables:
5+
CGO_ENABLED: 0
6+
GOARCH: amd64
7+
REPO_NAME: github.com/egeneralov/gitlab-system-hooks
8+
9+
.build: &build
10+
image: golang:1.14.2-alpine
11+
stage: build
12+
before_script:
13+
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
14+
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
15+
- cd $GOPATH/src/$REPO_NAME
16+
- export GO111MODULE=on
17+
script:
18+
- ls -lha
19+
- go mod download
20+
- go build -a -v -installsuffix cgo -ldflags="-w -s" -o ${CI_PROJECT_DIR}/gitlab-system-hooks-${GOOS}-${GOARCH}
21+
artifacts:
22+
paths:
23+
- ${CI_PROJECT_DIR}/gitlab-system-hooks-${GOOS}-${GOARCH}
24+
when: on_success
25+
expire_in: 180 days
26+
27+
28+
darwin:
29+
variables:
30+
GOOS: darwin
31+
<<: *build
32+
33+
linux:
34+
variables:
35+
GOOS: linux
36+
<<: *build
37+
38+
docker:
39+
image: docker:latest
40+
stage: build
41+
services:
42+
- docker:dind
43+
variables:
44+
DOCKER_BUILDKIT: 1
45+
script:
46+
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
47+
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}" .
48+
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}"
49+

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:1.14.2-alpine
2+
3+
RUN apk add --no-cache ca-certificates
4+
5+
ENV \
6+
GO111MODULE=on \
7+
CGO_ENABLED=0 \
8+
GOOS=linux \
9+
GOARCH=amd64
10+
11+
WORKDIR /go/src/github.com/egeneralov/gitlab-system-hooks
12+
ADD go.mod go.sum /go/src/github.com/egeneralov/gitlab-system-hooks/
13+
RUN go mod download
14+
15+
ADD . .
16+
17+
RUN go build -v -installsuffix cgo -ldflags="-w -s" -o /go/bin/gitlab-system-hooks .
18+
19+
20+
FROM alpine
21+
22+
RUN apk add --no-cache ca-certificates
23+
USER nobody
24+
ENV PATH='/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
25+
CMD /go/bin/gitlab-system-hooks
26+
27+
COPY --from=0 /go/bin /go/bin
28+
29+

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Eduard Generalov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# gitlab-system-hooks
2+
3+
WIP: rewriting old python script
4+

go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/egeneralov/gitlab-system-hooks
2+
3+
go 1.14
4+
5+
require (
6+
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
7+
github.com/sirupsen/logrus v1.6.0
8+
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
9+
)

go.sum

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/go-telegram-bot-api/telegram-bot-api v1.0.0 h1:HXVtsZ+yINQeyyhPFAUU4yKmeN+iFhJ87jXZOC016gs=
3+
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
4+
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
5+
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
6+
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
7+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8+
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
9+
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
10+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
11+
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
12+
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
13+
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
14+
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

0 commit comments

Comments
 (0)