Skip to content
This repository was archived by the owner on Apr 5, 2023. It is now read-only.

Commit 95f45ac

Browse files
committed
feat: initial cicd tooling
1 parent c1e143c commit 95f45ac

14 files changed

+4046
-15
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
config.yaml
2+
bin
3+
dist
4+
.cache

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
bin
2+
dist
3+
.cache

.goreleaser.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
project_name: jira-wrangler
2+
before:
3+
hooks:
4+
- go mod tidy
5+
- go mod verify
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
- darwin
12+
- windows
13+
main: ./cmd/jira-wrangler
14+
binary: jira-wrangler
15+
archives:
16+
- format_overrides:
17+
- goos: windows
18+
format: zip
19+
dockers:
20+
- image_templates:
21+
- "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_ORG }}/{{ .ProjectName }}:latest"
22+
- "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_ORG }}/{{ .ProjectName }}:{{ .Tag }}"
23+
- "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_ORG }}/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}"
24+
checksum:
25+
name_template: 'checksums.txt'
26+
snapshot:
27+
name_template: "{{ incpatch .Version }}-next"
28+
changelog:
29+
use: github
30+
groups:
31+
- title: Breaking
32+
regexp: "^.*(fix|feat)[(\\w)]*!:+.*$"
33+
order: 0
34+
- title: Changes
35+
regexp: "^.*feat[(\\w)]*:+.*$"
36+
order: 10
37+
- title: Bugfixes
38+
regexp: "^.*fix[(\\w)]*:+.*$"
39+
order: 20
40+
- title: Trivial
41+
order: 999
42+
filters:
43+
exclude:
44+
- Merge pull request
45+
- '^docs:'
46+
- '^test:'

.pre-commit-config.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
repos:
3+
# Fixers
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.1.0
6+
hooks:
7+
- id: end-of-file-fixer
8+
- id: pretty-format-json
9+
args:
10+
- --autofix
11+
- id: trailing-whitespace
12+
13+
- repo: https://github.com/dnephin/pre-commit-golang
14+
rev: v0.5.0
15+
hooks:
16+
- id: go-fmt
17+
18+
- repo: local
19+
hooks:
20+
- id: go-mod-tidy
21+
name: go-mod-tidy
22+
language: system
23+
entry: ./mage check:tidy
24+
pass_filenames: false
25+
always_run: true
26+
require_serial: true
27+
- id: go-mod-verify
28+
name: go-mod-verify
29+
language: system
30+
entry: ./mage check:verify
31+
pass_filenames: false
32+
always_run: true
33+
require_serial: true
34+
35+
# Checkers
36+
- repo: https://github.com/pre-commit/pre-commit-hooks
37+
rev: v4.1.0
38+
hooks:
39+
- id: check-added-large-files
40+
- id: check-case-conflict
41+
- id: check-json
42+
- id: check-merge-conflict
43+
- id: check-symlinks
44+
- id: detect-private-key
45+
46+
- repo: local
47+
hooks:
48+
- id: golangci-lint
49+
name: golangci-lint
50+
language: system
51+
entry: ./mage check:lint
52+
pass_filenames: false
53+
types: [go]
54+
require_serial: true

Dockerfile

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:a781bcbb73344bf65c778305c9bdf06c82438fb188d0f2e35e3c3cfb2e834605 AS builder
2-
3-
WORKDIR /workspace
4-
5-
COPY . .
6-
7-
USER root
8-
9-
RUN make
10-
11-
USER default
12-
131
FROM registry.access.redhat.com/ubi9-minimal@sha256:e9ea62ea2017705205ba7bc55d20827e06abe4fe071f0793c6cae46edd5855cf
142

153
WORKDIR /app
164

17-
COPY --from=builder /workspace/bin/jira-wrangler .
5+
COPY /jira-wrangler .
186

197
USER 65532:65532
208

cmd/mage/main.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"os"
5+
6+
"github.com/magefile/mage/mage"
7+
)
8+
9+
func main() { os.Exit(mage.Main()) }

go.mod

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ go 1.19
44

55
require (
66
github.com/andygrunwald/go-jira/v2 v2.0.0-20221123211055-094697715517
7+
github.com/magefile/mage v1.14.0
8+
github.com/mt-sre/go-ci v0.6.4
9+
github.com/otiai10/copy v1.9.0
710
github.com/spf13/cobra v1.6.1
811
github.com/spf13/pflag v1.0.5
912
github.com/stretchr/testify v1.8.1
@@ -12,13 +15,16 @@ require (
1215
)
1316

1417
require (
18+
github.com/blang/semver/v4 v4.0.0 // indirect
1519
github.com/davecgh/go-spew v1.1.1 // indirect
1620
github.com/fatih/structs v1.1.0 // indirect
1721
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
1822
github.com/google/go-querystring v1.1.0 // indirect
1923
github.com/inconshreveable/mousetrap v1.0.1 // indirect
24+
github.com/kr/pretty v0.3.1 // indirect
2025
github.com/pmezard/go-difflib v1.0.0 // indirect
2126
github.com/trivago/tgo v1.0.7 // indirect
27+
golang.org/x/sys v0.4.0 // indirect
2228
gopkg.in/yaml.v2 v2.4.0 // indirect
2329
gopkg.in/yaml.v3 v3.0.1 // indirect
2430
)

go.sum

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
github.com/andygrunwald/go-jira/v2 v2.0.0-20221123211055-094697715517 h1:Ad9ZdMo5iKMaVVOhuCdCl2FFZNKA/YeeK+nP9DU9vyU=
22
github.com/andygrunwald/go-jira/v2 v2.0.0-20221123211055-094697715517/go.mod h1:8Wg9ZhNoktGf4TO0Bu7PdA25uWIHvkyG1qette1FKz8=
3+
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
4+
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
35
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
6+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
47
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
58
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
69
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
710
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
811
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
12+
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
913
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
1014
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
1115
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -14,8 +18,28 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
1418
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
1519
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
1620
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
21+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
22+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
23+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
24+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
25+
github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo=
26+
github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
27+
github.com/mt-sre/go-ci v0.6.4 h1:/0bX4n0zBp6Bzeyx8Mudpwty0Wa1QQfbH2i701dihto=
28+
github.com/mt-sre/go-ci v0.6.4/go.mod h1:zJZY61ZeAsVjhxviMBXvRw8SsrG2m01uAsf2e1uWQK0=
29+
github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI=
30+
github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q=
31+
github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4=
32+
github.com/otiai10/copy v1.9.0/go.mod h1:hsfX19wcn0UWIHUQ3/4fHuehhk2UyArQ9dVFAn3FczI=
33+
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
34+
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
35+
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
36+
github.com/otiai10/mint v1.4.0 h1:umwcf7gbpEwf7WFzqmWwSv0CzbeMsae2u9ZvpP8j2q4=
37+
github.com/otiai10/mint v1.4.0/go.mod h1:gifjb2MYOoULtKLqUAEILUG/9KONW6f7YsJ6vQLTlFI=
38+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
1739
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1840
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
41+
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
42+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
1943
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
2044
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
2145
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
@@ -32,9 +56,14 @@ github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM=
3256
github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc=
3357
golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874 h1:kWC3b7j6Fu09SnEBr7P4PuQyM0R6sqyH9R+EjIvT1nQ=
3458
golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
59+
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
60+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
61+
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
62+
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
63+
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
3564
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
36-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3765
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
66+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
3867
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
3968
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
4069
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/jira/client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package jira
33
import (
44
"context"
55
"fmt"
6-
jira "github.com/andygrunwald/go-jira/v2/onpremise"
76
"net/http"
87
"strings"
8+
9+
jira "github.com/andygrunwald/go-jira/v2/onpremise"
910
)
1011

1112
const (

mage

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
export PROJECT_ROOT="${PWD}"
5+
export DEPENDENCY_DIR="${PROJECT_ROOT}/.cache/dependencies"
6+
export MAGEFILE_CACHE="${PROJECT_ROOT}/.cache/magefile"
7+
export GOFLAGS=""
8+
9+
if [ ! -f "bin/mage" ]; then
10+
go build -o bin/mage ./cmd/mage
11+
fi
12+
13+
exec ./bin/mage -v "$@"

0 commit comments

Comments
 (0)