Skip to content

Commit

Permalink
Add CI + boilerplate (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
0sewa0 authored Jan 16, 2025
1 parent 1cca98c commit b9ff9e5
Show file tree
Hide file tree
Showing 26 changed files with 1,069 additions and 4 deletions.
48 changes: 48 additions & 0 deletions .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build Docker Image
description: Builds the bootstrapper docker image
inputs:
platform:
description: The platform for which the image will be built
required: true
labels:
description: The labels for the built image
required: true
image-tag:
description: The tag of the built image
required: true
runs:
using: "composite"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Set up Golang
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Prepare build parameters
id: prep
shell: bash
run: |
hack/build/ci/prepare-build-variables.sh
- name: Build target
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: |
GO_LINKER_ARGS=${{ steps.prep.outputs.go_linker_args }}
context: .
file: ./Dockerfile
platforms: linux/${{ inputs.platform }}
push: false
tags: bootstrapper-${{ inputs.platform }}:${{ inputs.image-tag }}
labels: ${{ inputs.labels }}
outputs: type=docker,dest=/tmp/bootstrapper-${{ inputs.platform }}.tar
- name: Upload artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: bootstrapper-${{ inputs.platform }}
path: /tmp/bootstrapper-${{ inputs.platform }}.tar
retention-days: 1

34 changes: 34 additions & 0 deletions .github/label-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
feature request:
comment: >
Thank you for opening a Dynatrace Bootrapper Issue. We've identified and tagged the issue as a "**Feature request**".
Dynatrace reviews feature requests in the [Dynatrace community](https://community.dynatrace.com/) rather than Github. This helps our team consolidate, rank, and prioritize important input like yours.
Please search for similar requests, collaborate, and ask questions using the link above. Remember to add the labels "kubernetes" and "dynatrace-bootrapper" to help get the attention you deserve.
Thanks for your help!
close: true

-feature request:
comment: >
It isn't a "Feature request".
reopen: true

support request:
comment: >
Thank you for opening a Dynatrace Bootrapper Issue. We've identified and tagged the issue as a "**Support request**".
Dynatrace responds to requests like these via [Dynatrace ONE support](https://support.dynatrace.com/) rather than Github. This helps our team respond as quickly as possible using the support team's tools and procedures.
Thanks for your help!
close: true

-support request:
comment: >
It isn't a "Support request".
reopen: true
47 changes: 47 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Check linting and unit tests before commiting
# if linting fails the commit will be aborted and the linting will start auto fixing
# if unit tests fail the commit will be aborted

# Linting

echo Shell: "${SHELL}"

echo Linting markdown files...
make markdown/lint

## this will retrieve all of the .go files that have been
## changed since the last commit
STAGED_GO_FILES=$(git diff --cached --name-only -- '*.go')

## we can check to see if this is empty
if [[ ${STAGED_GO_FILES} == "" ]]; then
echo "No Go Files to Update"
exit 0
## otherwise we can do stuff with these changed go files
else
for file in ${STAGED_GO_FILES}; do
make LINT_TARGET="${file}" go/format
## add any potential changes from our formatting to the
## commit
git add "${file}"
done
fi


make go/golangci
res=${?}
if [[ ${res} -ne 0 ]]; then
echo "Linting failed"
exit 2
fi

echo "Run unit tests..."
make go/test
res=${?}
if [[ ${res} -ne 0 ]]; then
echo "Unit test failed"
exit 2
fi
echo
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
Thanks for opening a pull request! Here are some tips to get everything merged smoothly:
1. Read our contributor guidelines: https://github.com/Dynatrace/dynatrace-bootstrapper/blob/main/CONTRIBUTING.md
2. If the PR is unfinished, raise it as a draft or prefix the title with "WIP:" so it's clear to everyone.
3. Be sure to allow edits from maintainers, so it's easier for us to help: https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork
-->

## Description

<!--
Please include the following:
- The motivation for the change
- Link to the Github issue or Jira ticket, if exists.
- The summary of the change
-->

## How can this be tested?

<!--
Please include some guiding steps on how to test this change during a review.
- What environment is necessary for the change to be noticeable ?
- What needs to be enabled/applied for the change to be noticeable ?
-->
135 changes: 135 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
],
labels: [
"dependencies",
],
digest: {
enabled: false,
},
baseBranches: [
"$default",
],
enabledManagers: [
"regex",
"dockerfile",
"gomod",
"github-actions",
],
postUpdateOptions: [
"gomodTidy",
"gomodTidy1.17",
],
automergeType: "pr",
automerge: true,
regexManagers: [
{
fileMatch: [
"(^|/|\\.)prerequisites.mk$",
],
matchStrings: [
"depName=(?<depName>.*?)\\s.*?_version=(?<currentValue>.*)\\s",
],
datasourceTemplate: "go",
},
{
fileMatch: [
"(^|/|\\.)ci.yaml$",
],
matchStrings: [
"depName=(?<depName>.*?)\\s.*?version\\:\\s(?<currentValue>.*)\\s",
],
datasourceTemplate: "go",
},
{
fileMatch: [
"(^|/|\\.)action.yaml$",
],
matchStrings: [
"depName=(?<depName>.*?)\\s.*?PREFLIGHT_VERSION\\:\\s(?<currentValue>.*)\\s",
],
datasourceTemplate: "github-releases",
},
],
packageRules: [
{
matchBaseBranches: [
"$default",
],
matchUpdateTypes: [
"major",
"minor",
],
enabled: false,
automerge: true,
},
{
matchManagers: [
"dockerfile",
],
matchBaseBranches: [
"$default",
],
commitMessagePrefix: "Docker:",
enabled: true,
allowedVersions: "/^v?[0-9]+[\\.\\-][0-9]+([\\-\\.][0-9]+)*$/",
automerge: true,
},
{
matchManagers: [
"gomod",
],
matchBaseBranches: [
"$default",
],
commitMessagePrefix: "Go:",
enabled: true,
allowedVersions: "/^v?[0-9]+[\\.\\-][0-9]+([\\-\\.][0-9]+)*$/",
automerge: true,
},
{
matchManagers: [
"gomod",
],
matchDepTypes: [
"indirect",
],
enabled: false,
automerge: true,
},
{
matchManagers: [
"github-actions",
],
matchBaseBranches: [
"$default",
],
commitMessagePrefix: "Actions:",
enabled: true,
automerge: true,
allowedVersions: "/^v?[0-9]+[\\.\\-][0-9]+([\\-\\.][0-9]+)*$/",
},
{
matchManagers: [
"regex",
],
matchBaseBranches: [
"$default",
],
commitMessagePrefix: "Dev:",
enabled: true,
automerge: true,
},
{
matchPackageNames: [
"markdownlint-cli",
],
pinVersions: true,
enabled: true,
automerge: true,
},
],
platformAutomerge: true,
}
Loading

0 comments on commit b9ff9e5

Please sign in to comment.