Skip to content

Commit

Permalink
Self hosted release 0.23.0 #2254
Browse files Browse the repository at this point in the history
Self hosted release 0.23.0
  • Loading branch information
etaques authored Feb 28, 2023
2 parents bce168f + 8ff51ee commit 13518f0
Show file tree
Hide file tree
Showing 411 changed files with 5,222 additions and 5,021 deletions.
15 changes: 10 additions & 5 deletions .github/actions/go-report/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM golang:1.15.1-alpine3.12
FROM golang:1.20-alpine

LABEL author="Everton Taques<[email protected]>"
LABEL maintainer="ns1labs"
LABEL version="1.0.0"

RUN mkdir -p /workspace

WORKDIR /workspace

COPY ./entrypoint.sh /entrypoint.sh

RUN apk add git && \
RUN apk add git make curl jq && \
wget https://github.com/cloudposse/github-commenter/releases/download/0.7.0/github-commenter_linux_amd64 -O /github-commenter && \
apk add jq && \
chmod +x /github-commenter /entrypoint.sh

RUN git clone https://github.com/gojp/goreportcard.git && \
cd goreportcard && \
make install && \
go install ./cmd/goreportcard-cli && \
mv /go/bin/goreportcard-cli /usr/local/bin/goreportcard-cli

WORKDIR /workspace

CMD ["/entrypoint.sh"]
18 changes: 15 additions & 3 deletions .github/actions/go-report/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
name: 'go-report'
author: 'Rogiel Silva<rssilvas@daitan.com>'
description: 'Daitan Digital Solutions Docker Actions'
author: 'Everton Haise Taques<everton.taques@encora.com>'
description: 'netboxlabs'

inputs:
go_report_threshold:
description: " Threshold of failure"
required: true

github_token:
description: " github token"
required: true

github_owner:
description: " github owner"
required: true

github_repo:
description: " github repo"
required: true

runs:
using: 'docker'
image: 'Dockerfile'
image: 'Dockerfile'
34 changes: 21 additions & 13 deletions .github/actions/go-report/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
function validateParams() {
echo "========================= Checking parameters ========================="
[[ -z $INPUT_GO_REPORT_THRESHOLD ]] && echo "Threshold of failure is required" && exit 1 echo " Threshold of failure present"
[[ -z $INPUT_GITHUB_TOKEN ]] && echo "GITHUB TOKEN is required" && exit 1 echo " GITHUB TOKEN present"
[[ -z $INPUT_GITHUB_OWNER ]] && echo "GITHUB OWNER is required" && exit 1 echo " GITHUB OWNER present"
[[ -z $INPUT_GITHUB_REPO ]] && echo "GITHUB REPO is required" && exit 1 echo " GITHUB REPO present"

}

function setup() {
echo "========================= Installing Go Report Card ========================="
echo "========================= Installing Go Metalinter ========================="
validateParams
cd /tmp
go get github.com/alecthomas/gometalinter
gometalinter --install --update
go get github.com/gojp/goreportcard/cmd/goreportcard-cli
curl -L https://git.io/vp6lP | sh
gometalinter --no-vendored-linters
}

function run() {
Expand Down Expand Up @@ -41,15 +44,20 @@ function test() {

function comment() {
echo "========================= Adding Comment To PR ========================="
export GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
cat ./go-report.txt | /github-commenter \
-token "${GITHUB_TOKEN}" \
-type pr \
-owner ${GITHUB_OWNER} \
-repo ${GITHUB_REPO} \
-number ${GITHUB_PR_ISSUE_NUMBER} \
-template_file ./build/ci/go-report-comment-template

re='^[0-9]+$'
GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo $GITHUB_PR_ISSUE_NUMBER
if [[ $GITHUB_PR_ISSUE_NUMBER =~ $re ]]; then
cat ./go-report.txt | /github-commenter \
-token "${INPUT_GITHUB_TOKEN}" \
-type pr \
-owner ${INPUT_GITHUB_OWNER} \
-repo ${INPUT_GITHUB_REPO} \
-number ${GITHUB_PR_ISSUE_NUMBER} \
-template_file ./.github/ci/go-report-comment-template
else
echo "this is not a pr, nothing to comment"
fi
}

setup
Expand Down
4 changes: 4 additions & 0 deletions .github/ci/go-report-comment-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ $go_report_threshold := 90.1 }}
Grade is below {{ $go_report_threshold }}% (Grade A+)
Output from go report<br/>
<pre>{{.}}</pre>
59 changes: 34 additions & 25 deletions .github/workflows/go-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
uses: ./.github/actions/go-report
with:
go_report_threshold: 90.1 #grade A+
github_token: ${{ secrets.GH_ORB_ACCESS_TOKEN }}
github_owner: orb-community
github_repo: orb

- name: refresh go-report
uses: creekorful/[email protected]
Expand All @@ -101,7 +104,7 @@ jobs:
if: ${{ needs.prebuild.outputs.docs == 'true' && github.event_name != 'pull_request' }}
with:
token: ${{ secrets.GH_ORB_ACCESS_TOKEN }}
repository: ns1labs/orb-website
repository: orb-community/orb-website
event-type: build-docs
client-payload: '{"branch_name": "main"}'

Expand All @@ -116,29 +119,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.agent == 'true' }}
if: ${{ needs.prebuild.outputs.agent == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=agent make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.agent == 'true' }}
if: ${{ needs.prebuild.outputs.agent == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.agent == 'true' }}
if: ${{ needs.prebuild.outputs.agent == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.agent == 'true' }}
if: ${{ needs.prebuild.outputs.agent == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand All @@ -154,29 +158,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=fleet make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand All @@ -192,29 +197,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=policies make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand All @@ -230,29 +236,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=sinks make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand All @@ -268,29 +275,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=sinker make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand All @@ -306,29 +314,30 @@ jobs:
go-version: 1.19

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
SERVICE=maestro make test_service_cov
- name: Install dependencies
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
go mod tidy
sudo apt update && sudo apt install -y build-essential jq
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
- name: coverage to xml
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
run: |
echo "Current directory: ${PWD}"
echo "GITHUB_PR_ISSUE_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
gocov convert ./coverage.out | gocov-xml > ./coverage.xml
- name: Upload coverage to Codecov
if: ${{ needs.prebuild.outputs.orb == 'true' }}
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
files: coverage.xml
name: orb
verbose: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ jobs:
with:
branch: production
header: ":first_place_medal: :orb: *Deployed new features in orb.live* :orb: :rocket: :tada:"
github_repo: ns1labs/orb
github_repo: orb-community/orb
slack_channel: C041B9204CF # orb netdev slack channel ID
slack_api_token: ${{ secrets.SLACK_APP_TOKEN }}

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.DS_Store*
build/*
localconfig/
.vscode/

**/.env

Expand Down Expand Up @@ -32,3 +33,6 @@ python-test/behave_orb
test_agent_name*
docker/otel-collector-config.yaml
!docker/otel-collector-config.yaml.tpl

kind/*
!kind/README.md
Loading

0 comments on commit 13518f0

Please sign in to comment.