Giter Site home page Giter Site logo

aliok / knobots Goto Github PK

View Code? Open in Web Editor NEW

This project forked from knative-extensions/knobots

0.0 1.0 0.0 312 KB

A collection of github actions for routine maintenance of Knative repositories.

License: Apache License 2.0

Shell 58.71% Go 17.70% Dockerfile 23.59%

knobots's Introduction

Welcome to knobots

This repository contains a number of github actions, which perform routine maintenance tasks for a variety of repositories, mostly for the knative org. In particular, this repo exists separately from other repos like https://github.com/knative/test-infra to enable using repository secrets to hold an access token for creating automated PRs.

If you want to run a job periodically against a repo, the workload-templates folder holds all the template actions which are copied to all the repos in Knative using the update-actions workflow in this repo.

Adding a repo

To add a repository here, there are two requirements:

  1. Add an entry to repos.yaml containing an entry like this:

     - # name is the repository to operate on, think: https://github.com/{name}.git
       name: 'knative/pkg'
    
       # meta-organization is the github organization from which to sync Github
       # actions, think: https://github.com/{meta-organization}/hack
       # Actions are pulled from the workflow-templates directory.
       meta-organization: 'knative'
    
       # fork is the name of the fork to push to (otherwise a branch on the
       # main repo is used)
       fork: 'knative-automation/pkg'
    
       # channel is the channel on knative.slack.com to post when these actions fail.
       # These can be a direct-message to a username if prefixed with `@`
       channel: 'serving-api'
    
       # The list of users to which the PR should be `/assign` (only matters for Prow)
       # These should bias toward Github teams, but must exist within the target
       # organization (so knative[-sandbox] should use the team in their respective org).
       assignees: knative/foo-wg-leads
  2. github.com/{fork}.git must be a fork of {name} (if specified) and knative-automation must have push access.

  3. Repos can also optionally exclude certain jobs by adding their name to the appropriate {foo}-exclude.yaml file.

Adding new automation

This repo exists to run GitHub Actions to create automated management PRs against other repos in Knative. To add a new automated PR workflow (or update one of the existing workflows), it's worth understanding the different components in this repo:

  • .github/workflows contains the actual GitHub Actions, in the Actions yaml format. These are (mostly) generated from the actions directories mentioned below, but a few are hand-maintained. For the generated workflows, run go run ./cmd/gen-actions at the root of the repo to regnerate the files, which will need to be checked in / PR'ed if changed.

  • actions contains a set of GitHub Actions, either as Dockerfile actions or Javascript actions. Each directory under actions should contain the following:

    • action.yaml -- GitHub actions configuration. This file makes the directory an action.

    • Dockerfile (and probably entrypoint.sh) for Docker-based Actions OR index.js and package-lock.json et al for Javascript actions

    • If you want the action to be run against each repo configured in repos.yaml, add an auto-apply.yaml (schema here). This will cause the gen-actions tool (see below) to generate a github/workflows file which will fan out your command to all repos.

      It's expected that an auto-apply action will modify the checked-out workspace; these changes will export a create_pr variable (set to true if a PR shoud be created) and optionally a log output.

  • cmd/gen-actions contains a script (main.go) and a template {actions_template.yaml) for generating fan-out PR generation workflows for all the actions directories which include an auto-apply.yaml.

    The parameters set in auto-apply.yaml are passed in to the actions_template.yaml, along with a github formatting function which passes through the remianing arguments to the GitHub Actions templating system (both use the same {{...}} syntax for templating, so any GitHub templating needs to be escaped from the Go templates).

    This script should stay fairly short; it's written in Go for two reasons:

    1. Go is a common language across Knative, and has sufficiently rich templating
    2. Using Go enables the script to work even on Windows machines, which is a nice benefit

knobots's People

Contributors

knative-automation avatar dprotaso avatar psschwei avatar mattmoor avatar krsna-m avatar dsimansk avatar nak3 avatar markusthoemmes avatar pierdipi avatar rhuss avatar lionelvillard avatar creydr avatar evankanderson avatar upodroid avatar chizhg avatar imjasonh avatar retocode avatar lance avatar slinkydeveloper avatar davidhadas avatar cali0707 avatar cardil avatar grantr avatar matzew avatar nlopezgi avatar vaikas avatar pradnyavmw avatar houshengbo avatar sbdtu5498 avatar naveensrinivasan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.