chore: address random CI nits

This PR does the following:

- updates the conform config
- cleans up conform scopes
- moves slash commands to the talos-bot
- adds a check list to the pull request template
- disables codecov comments
- uses `BOT_TOKEN` so all actions are performed as the talos-bot user
- adds a `make conformance` target to make it easy for contributors to
check their commit before creating a PR
- bumps golangci-lint to v1.24.0

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This commit is contained in:
Andrew Rynhard
2020-04-10 17:06:59 -07:00
committed by talos-bot
parent 0af7624c7d
commit a10acd592a
13 changed files with 48 additions and 158 deletions

View File

@@ -7,5 +7,4 @@ coverage:
base: auto
patch: off
comment:
require_changes: yes
comment: false

View File

@@ -1,12 +1,18 @@
policies:
- type: commit
spec:
headerLength: 89
dco: true
gpg: false
imperative: true
spellcheck:
locale: US
maximumOfOneCommit: true
requireCommitBody: true
header:
length: 89
imperative: true
case: lower
invalidLastCharacters: .
body:
required: true
conventional:
types:
- chore
@@ -16,30 +22,20 @@ policies:
- style
- test
scopes:
- ami
- apid
- ci
- conformance
- gpt
- hack
- image
- init
- initramfs
- kernel
- machined
- networkd
- ntpd
- talosctl
- osd
- rootfs
- tools
- trustd
- routerd
- talosctl
- kernel
- '*'
- type: license
spec:
skipPaths:
- .git/
- .buildkit/
includeSuffixes:
- .go
excludeSuffixes:

View File

@@ -15,14 +15,6 @@ platform:
arch: amd64
steps:
- name: ok-to-test
image: autonomy/build-container:latest
commands:
- curl --request GET "https://api.github.com/repos/$DRONE_REPO/issues/$DRONE_PULL_REQUEST" | jq -e '.labels[]|select(.name == "ok-to-test")'
when:
event:
- pull_request
- name: setup-ci
image: autonomy/build-container:latest
commands:
@@ -3989,6 +3981,6 @@ depends_on:
---
kind: signature
hmac: 963c1f5e9294c377ec08a13e8bdfe62405a503f683889048a309ab4c90bf257e
hmac: 28c6eccbd80b6a1203d1acb05a3e1812ba6536df88839431f0c77e16e8fc496e
...

View File

@@ -1,22 +1,29 @@
# Pull Request
<!--
Thank you for contributing to Talos!
## Note to the Contributor
Here's a brief list of TODOs that might make your contribution easier to merge:
- Your PR should consist of a single commit. Please squash multiple commits before submitting.
- Ensure your commit is signed. This can be done with the `git commit -s` flag.
- We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) in our repositories. Please make sure your commit is formatted according to this spec (Examples are: `feat: ...`, `fix: ...`, `docs: ...`).
- We use a `rebase and merge` strategy for this repository. In order to make sure your changes are merged quickly, please ensure you are rebased off of the latest commit.
- One of our maintainers will comment on your PR with `/test`. Maintainers are the only ones capable of performing this function. This command will kick off our CI suite against your changes, which must pass before changes are merged.
- As an extension of the previous bullet, you may wish to run `make lint` and `make unit-tests` locally. These will allow you to catch basic issues before CI.
We encourage contributors to go through a proposal process to discuss major changes.
Before your PR is allowed to run through CI, the maintainers of Talos will first have to accept the PR.
One of our maintainers will comment on your PR with `/accepted`.
-->
**What this PR does / why we need it**:
## What? (description)
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
## Why? (reasoning)
## Logs (if applicable)
## Acceptance
Please use the following checklist:
- [ ] you linked an issue (if applicable)
- [ ] you included tests (if applicable)
- [ ] you ran conformance (`make conformance`)
- [ ] you formatted your code (`make fmt`)
- [ ] you linted your code (`make lint`)
- [ ] you generated documentation (`make docs`)
- [ ] you ran unit-tests (`make unit-tests`)
> See `make help` for a description of the available targets.

View File

@@ -1,45 +0,0 @@
name: Check OK To Test
on:
issue_comment:
types: [created]
jobs:
check_ok_to_test:
runs-on: ubuntu-latest
name: "Check comments for /test"
steps:
- name: Check for test slash command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: "test"
permission-level: "write"
reaction: "true"
reaction-type: "rocket"
- uses: actions/checkout@master
- name: Apply ok-to-test Label
uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: label ok-to-test
- name: Retrigger drone
run: |
## Fetch PR number and github status URL
PULL_NUMBER=$(jq -r .issue.number "$GITHUB_EVENT_PATH")
PR_INFO=$(curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER")
STATUS_URL=$(echo $PR_INFO | jq -r .statuses_url)
## Discover previous drone build number and send it a post to retrigger
DRONE_BUILD_URL=$(curl -s $STATUS_URL | jq -r '[.[] | select(.context == "continuous-integration/drone/pr")][0].target_url')
DRONE_BUILD_NUM=${DRONE_BUILD_URL##*/}
docker run -e "DRONE_SERVER=$DRONE_SERVER" -e "DRONE_TOKEN=$DRONE_TOKEN" drone/cli:1.2.1 build restart $GITHUB_REPOSITORY $DRONE_BUILD_NUM
env:
GITHUB_EVENT_PATH: $GITHUB_EVENT_PATH
DRONE_SERVER: "https://ci.dev.talos-systems.io"
DRONE_TOKEN: ${{ secrets.DRONE_TOKEN }}

View File

@@ -1,46 +0,0 @@
name: Promote E2E
on:
issue_comment:
types: [created]
jobs:
check_ok_to_test:
runs-on: ubuntu-latest
name: "Check comments for /e2e"
steps:
- name: Check for test slash command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: "e2e"
permission-level: "write"
reaction: "true"
reaction-type: "rocket"
- name: Checkout repo
uses: actions/checkout@master
- name: Apply needs-e2e Label
uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: label needs-e2e
- name: Retrigger drone
run: |
## Fetch PR number and github status URL
PULL_NUMBER=$(jq -r .issue.number "$GITHUB_EVENT_PATH")
PR_INFO=$(curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER")
STATUS_URL=$(echo $PR_INFO | jq -r .statuses_url)
## Discover previous drone build number and send it a post to promote
DRONE_BUILD_URL=$(curl -s $STATUS_URL | jq -r '[.[] | select(.context == "continuous-integration/drone/pr")][0].target_url')
DRONE_BUILD_NUM=${DRONE_BUILD_URL##*/}
docker run -e "DRONE_SERVER=$DRONE_SERVER" -e "DRONE_TOKEN=$DRONE_TOKEN" drone/cli:1.2.1 build promote $GITHUB_REPOSITORY $DRONE_BUILD_NUM e2e
env:
GITHUB_EVENT_PATH: $GITHUB_EVENT_PATH
DRONE_SERVER: "https://ci.dev.talos-systems.io"
DRONE_TOKEN: ${{ secrets.DRONE_TOKEN }}

View File

@@ -12,7 +12,7 @@ ENV PATH /toolchain/bin:/toolchain/go/bin
RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/bin/bash", "/bin/sh"]
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/etc/ssl", "/etc/ssl"]
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.23.6
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.24.0
RUN cd $(mktemp -d) \
&& go mod init tmp \
&& go get mvdan.cc/gofumpt/gofumports@aaa7156f4122b1055c466e26e77812fa32bac1d9 \

View File

@@ -236,6 +236,10 @@ release-artifacts:
# Utilities
.PHONY: conformance
conformance: ## Performs policy checks against the commit and source code.
docker run --rm -it -v $(PWD):/src -w /src docker.io/autonomy/conform:v0.1.0-alpha.19
.PHONY: login
login: ## Logs in to the configured container registry.
ifeq ($(DOCKER_LOGIN_ENABLED), true)

View File

@@ -92,23 +92,6 @@ local volumes = {
],
};
// TODO(rsmitty): figure out how we can keep docker and setup-ci from running while also supporting
// times when we're not using those in the default pipeline (e2e and conformance for ex.)
// Sets up the CI environment
local check_ok_test = {
name: 'ok-to-test',
image: 'autonomy/build-container:latest',
privileged: false,
environment: {},
commands: [
'curl --request GET "https://api.github.com/repos/$DRONE_REPO/issues/$DRONE_PULL_REQUEST" | jq -e \'.labels[]|select(.name == "ok-to-test")\''
],
volumes: [],
when: {
event: ['pull_request'],
},
};
// This provides the docker service.
local docker = {
name: 'docker',
@@ -326,7 +309,7 @@ local default_trigger = {
},
};
local default_pipeline = Pipeline('default', [check_ok_test] + default_steps) + default_trigger;
local default_pipeline = Pipeline('default', default_steps) + default_trigger;
// E2E pipeline.

View File

@@ -104,7 +104,7 @@ func init() {
}
}
// nolint: gogcylo
// nolint: gocyclo
func revert() (err error) {
f, err := os.OpenFile(syslinux.SyslinuxLdlinux, os.O_RDWR, 0700)
if err != nil {

View File

@@ -194,7 +194,7 @@ func (suite *ResolverSuite) TestRegistryHosts() {
resp := &http.Response{}
resp.Request = req
resp.Header = http.Header{}
resp.Header.Add(http.CanonicalHeaderKey("WWW-Authenticate"), "Basic realm=\"Access to the staging site\", charset=\"UTF-8\"")
resp.Header.Add("WWW-Authenticate", "Basic realm=\"Access to the staging site\", charset=\"UTF-8\"")
suite.Require().NoError(registryHosts[0].Authorizer.AddResponses(context.Background(), []*http.Response{resp}))
suite.Require().NoError(registryHosts[0].Authorizer.Authorize(context.Background(), req))

View File

@@ -19,7 +19,7 @@ type Writer struct {
KmsgWriter io.Writer
}
// Writer implements io.Writer interface.
// Write implements io.Writer interface.
func (w *Writer) Write(p []byte) (n int, err error) {
// split writes by `\n`, and limit each line to MaxLineLength
for len(p) > 0 {

View File

@@ -71,5 +71,5 @@ func printLong(v *machineapi.VersionInfo) {
// PrintShortVersion prints the tag and SHA.
func PrintShortVersion() {
fmt.Println(fmt.Sprintf("%s %s-%s", Name, Tag, SHA))
fmt.Printf("%s %s-%s\n", Name, Tag, SHA)
}