-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from stakater/add-pipeline
Add pipeline
- Loading branch information
Showing
10 changed files
with
251 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
DOCKER_FILE_PATH: Dockerfile | ||
GOLANG_VERSION: 1.14 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0 | ||
golangci-lint run --timeout=10m ./... | ||
# - name: Test | ||
# run: GOFLAGS="-count=1" go test -v ./... -coverprofile cover.out | ||
|
||
- name: Generate Tag | ||
id: generate_tag | ||
run: | | ||
sha=${{ github.event.pull_request.head.sha }} | ||
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}" | ||
echo "##[set-output name=GIT_TAG;]$(echo ${tag})" | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.STAKATER_NEXUS_USERNAME }} | ||
password: ${{ secrets.STAKATER_NEXUS_PASSWORD }} | ||
registry: ${{ secrets.STAKATER_NEXUS_REGISTRY }} | ||
repository: ${{ env.GITHUB_REPOSITORY }} | ||
add_git_labels: true | ||
dockerfile: ${{ env.DOCKER_FILE_PATH }} | ||
tags: ${{ steps.generate_tag.outputs.GIT_TAG }} | ||
|
||
|
||
- name: Comment on PR | ||
uses: thollander/actions-comment-pull-request@master | ||
with: | ||
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ secrets.STAKATER_NEXUS_REGISTRY }}/${{ github.repository }}:${{ steps.generate_tag.outputs.GIT_TAG }}`' | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
|
||
- name: Notify Failure | ||
if: failure() | ||
uses: thollander/actions-comment-pull-request@master | ||
with: | ||
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!' | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() # Pick up events even if the job fails or is canceled. | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
DOCKER_FILE_PATH: Dockerfile | ||
GOLANG_VERSION: 1.14 | ||
OPERATOR_SDK_VERSION: "0.19.0" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0 | ||
golangci-lint run --timeout=10m ./... | ||
# - name: Test | ||
# run: GOFLAGS="-count=1" go test -v ./... -coverprofile cover.out | ||
|
||
- name: Generate Tag | ||
id: generate_tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
DRY_RUN: true | ||
|
||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.STAKATER_NEXUS_USERNAME }} | ||
password: ${{ secrets.STAKATER_NEXUS_PASSWORD }} | ||
registry: ${{ secrets.STAKATER_NEXUS_REGISTRY }} | ||
repository: ${{ env.GITHUB_REPOSITORY }} | ||
add_git_labels: true | ||
dockerfile: ${{ env.DOCKER_FILE_PATH }} | ||
tags: ${{ steps.generate_tag.outputs.new_tag }} | ||
|
||
|
||
############################## | ||
## Add steps to generate required artifacts for a release here(helm chart, operator manifest etc.) | ||
############################## | ||
|
||
- name: Install operator-sdk | ||
run: | | ||
curl -fL -o /tmp/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/v${env.OPERATOR_SDK_VERSION}/operator-sdk-v${env.OPERATOR_SDK_VERSION}-x86_64-linux-gnu" | ||
sudo install /tmp/operator-sdk /usr/local/bin && rm -f /tmp/operator-sdk | ||
operator-sdk version | ||
operator-sdk version | grep -q "${env.OPERATOR_SDK_VERSION}" | ||
- name: Generate Bundle | ||
env: | ||
VERSION: ${{ steps.generate_tag.outputs.new_tag }} | ||
run: make bundle | ||
|
||
- name: Generate Package Manifests | ||
env: | ||
VERSION: ${{ steps.generate_tag.outputs.new_tag }} | ||
run: make packagemanifests | ||
|
||
- name: Push Latest Tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() # Pick up events even if the job fails or is canceled. | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Release Go project | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
GOLANG_VERSION: 1.14 | ||
|
||
jobs: | ||
build: | ||
name: GoReleaser build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/ | ||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
id: go | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@master | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ bin | |
*~ | ||
/_output/ | ||
/jira-service-desk-operator | ||
/.local/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
- go generate ./... | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters