Merge pull request #3 from infitx-org/feat/new-github-actions

GitHub actions
This commit is contained in:
David Fry
2025-03-26 16:10:16 +00:00
committed by GitHub
25 changed files with 163 additions and 140 deletions
-16
View File
@@ -14,10 +14,6 @@ env:
GOLANGCI_VERSION: 'v1.54.0'
DOCKER_BUILDX_VERSION: 'v0.9.1'
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
# step 'if env.XXX' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
jobs:
detect-noop:
runs-on: ubuntu-22.04
@@ -191,14 +187,6 @@ jobs:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Login to Upbound
uses: docker/login-action@v1
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
with:
registry: xpkg.upbound.io
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
- name: Checkout
uses: actions/checkout@v3
with:
@@ -245,7 +233,3 @@ jobs:
with:
name: output
path: _output/**
- name: Publish Artifacts
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
run: make publish BRANCH_NAME=${GITHUB_REF##*/}
-48
View File
@@ -1,48 +0,0 @@
name: Promote
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. v0.1.0)'
required: true
channel:
description: 'Release channel'
required: true
default: 'stable'
env:
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
DOCKER_USR: ${{ secrets.DOCKER_USR }}
AWS_USR: ${{ secrets.AWS_USR }}
jobs:
promote-artifacts:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Login to Docker
uses: docker/login-action@v1
if: env.DOCKER_USR != ''
with:
username: ${{ secrets.DOCKER_USR }}
password: ${{ secrets.DOCKER_PSW }}
- name: Promote Artifacts in S3 and Docker Hub
if: env.AWS_USR != '' && env.DOCKER_USR != ''
run: make -j2 promote BRANCH_NAME=${GITHUB_REF##*/}
env:
VERSION: ${{ github.event.inputs.version }}
CHANNEL: ${{ github.event.inputs.channel }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }}
+87
View File
@@ -0,0 +1,87 @@
name: Publish Provider
on:
push:
tags:
- '**'
workflow_dispatch: {}
env:
# Common versions
GO_VERSION: '1.23'
GOLANGCI_VERSION: 'v1.54.0'
DOCKER_BUILDX_VERSION: 'v0.9.1'
# Registry/Org names
CROSSPLANE_REGORG: 'ghcr.io/infitx-org'
jobs:
publish-provider:
runs-on: ubuntu-latest
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.CROSSPLANE_REGORG }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cachedir=$(make go.cachedir)" >> $GITHUB_ENV
- name: Cache the Go Build Cache
uses: actions/cache@v3
with:
path: ${{ env.cachedir }}
key: ${{ runner.os }}-build-publish-provider-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-publish-provider-
- name: Cache Go Dependencies
uses: actions/cache@v3
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Download Go Modules
run: make modules.download modules.check
- name: Build Provider
run: make -j2 build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
- name: Publish Provider
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
make publish XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME=main
else
make publishBRANCH_NAME=${GITHUB_REF##*/} XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME=${GITHUB_REF##*/}
fi
+4 -4
View File
@@ -1,6 +1,6 @@
# ====================================================================================
# Setup Project
PROJECT_NAME := provider-netbird
PROJECT_NAME := netbird-crossplane-provider
PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME)
PLATFORMS ?= linux_amd64 linux_arm64
@@ -30,7 +30,7 @@ GO111MODULE = on
# ====================================================================================
# Setup Images
IMAGES = provider-netbird
IMAGES = netbird-crossplane-provider
-include build/makelib/imagelight.mk
# ====================================================================================
@@ -40,12 +40,12 @@ XPKG_REG_ORGS ?= xpkg.upbound.io/crossplane
# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are
# inferred.
XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/crossplane
XPKGS = provider-netbird
XPKGS = netbird-crossplane-provider
-include build/makelib/xpkg.mk
# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
# we ensure image is present in daemon.
xpkg.build.provider-netbird: do.build.images
xpkg.build.netbird-crossplane-provider: do.build.images
fallthrough: submodules
@echo Initial setup complete. Running make again . . .
+9 -9
View File
@@ -30,7 +30,7 @@ Generally projects are named `provider-<name>`, with `name` being the API being
managed. Example project names are `provider-aws`, `provider-kubernetes`,
and `provider-github`.
The [provider-netbird](https://github.com/crossplane/provider-netbird) repository can be
The [netbird-crossplane-provider](https://github.com/crossplane/netbird-crossplane-provider) repository can be
used as a starting point for new providers. For [terrajet](https://github.com/crossplane/terrajet)-based providers, the
[provider-jet-netbird](https://github.com/crossplane-contrib/provider-jet-netbird) is
available.
@@ -43,17 +43,17 @@ Most Crossplane providers include the following files:
[provider-gcp/README.md](https://github.com/crossplane/provider-gcp/blob/master/README.md)
as an example)
- [ ] Code is licensed under the [Apache 2.0
License](https://github.com/crossplane/provider-netbird/blob/main/LICENSE)
License](https://github.com/crossplane/netbird-crossplane-provider/blob/main/LICENSE)
- [ ] Include a “Developer Certificate of Origin”. Example:
[DCO](https://github.com/upbound/build/blob/master/DCO)
- [ ] Include the CNCF [Code of
Conduct](https://github.com/crossplane/crossplane/blob/master/CODE_OF_CONDUCT.md)
- [ ] Update
[OWNERS.md](https://github.com/crossplane/provider-netbird/blob/main/OWNERS.md)
[OWNERS.md](https://github.com/crossplane/netbird-crossplane-provider/blob/main/OWNERS.md)
with contacts for project Owners
- [ ] Ensure `hack/boilerplate.go.txt` (used in Code generation) includes
Crossplane Authors, Apache license and any other Copyright statements:
[https://github.com/crossplane/provider-netbird/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/provider-netbird/blob/main/hack/boilerplate.go.txt)
[https://github.com/crossplane/netbird-crossplane-provider/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/netbird-crossplane-provider/blob/main/hack/boilerplate.go.txt)
- [ ] Include Documentation on how to:
- [ ] Install Provider
- [ ] Contribute to Development
@@ -68,7 +68,7 @@ There are a number of build tools and processes that are common across the
Crossplane ecosystem. Using these ensures a consistent development environment
across projects.
The [provider-netbird](https://github.com/crossplane/provider-netbird)
The [netbird-crossplane-provider](https://github.com/crossplane/netbird-crossplane-provider)
repository contains most of these settings.
- [ ] Use the [Upbound build](https://github.com/upbound/build) submodule. (see
@@ -81,7 +81,7 @@ repository contains most of these settings.
- [ ] Create a [Crossplane
Package](https://crossplane.io/docs/master/concepts/packages.html)
configuration (see
[package/crossplane.yaml)](https://github.com/crossplane/provider-netbird/blob/main/package/crossplane.yaml)
[package/crossplane.yaml)](https://github.com/crossplane/netbird-crossplane-provider/blob/main/package/crossplane.yaml)
## Deployment of Artifacts
@@ -96,7 +96,7 @@ the publish and promotion workflows.
In general, providers should:
- [ ] Utilize GitHub workflows from
<https://github.com/crossplane/provider-netbird/tree/main/.github/workflows>
<https://github.com/crossplane/netbird-crossplane-provider/tree/main/.github/workflows>
- [ ] Create OCI image repos to push Package and Controller images.
- [ ] Automatically push Provider images and packages via CI
- [ ] Add GitHub Secrets to push to Docker repository. (To be performed by
@@ -113,6 +113,6 @@ to grant your project access to the GitHub org scoped secrets.
- [ ] Follow recommendations at
[https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance)
- [ ] Enable Issues on your project and configure Issue netbirds (examples at:
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/provider-netbird/tree/master/.github/ISSUE_TEMPLATE))
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/netbird-crossplane-provider/tree/master/.github/ISSUE_TEMPLATE))
- [ ] Create Pull Request Netbirds: (example:
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/provider-netbird/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/netbird-crossplane-provider/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
+2 -2
View File
@@ -1,6 +1,6 @@
# provider-netbird
# netbird-crossplane-provider
`provider-netbird` is a minimal [Crossplane](https://crossplane.io/) Provider
`netbird-crossplane-provider` is a minimal [Crossplane](https://crossplane.io/) Provider
that is meant to be used as a netbird for implementing new Providers. It comes
with the following features that are meant to be refactored:
+2 -2
View File
@@ -20,8 +20,8 @@ package apis
import (
"k8s.io/apimachinery/pkg/runtime"
netbirdv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
nbgroupv1alpha1 "github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
netbirdv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
nbgroupv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
)
func init() {
+1 -1
View File
@@ -34,7 +34,7 @@ echo_error(){
# The name of your provider. Many provider Makefiles override this value.
PACKAGE_NAME="provider-netbird"
PACKAGE_NAME="netbird-crossplane-provider"
# ------------------------------
+6 -6
View File
@@ -37,10 +37,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/provider-netbird/apis"
"github.com/crossplane/provider-netbird/apis/v1alpha1"
netbird "github.com/crossplane/provider-netbird/internal/controller"
"github.com/crossplane/provider-netbird/internal/features"
"github.com/crossplane/netbird-crossplane-provider/apis"
"github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
netbird "github.com/crossplane/netbird-crossplane-provider/internal/controller"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
)
func main() {
@@ -60,7 +60,7 @@ func main() {
kingpin.MustParse(app.Parse(os.Args[1:]))
zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-netbird"))
log := logging.NewLogrLogger(zl.WithName("netbird-crossplane-provider"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
@@ -86,7 +86,7 @@ func main() {
// server. Switching to Leases only and longer leases appears to
// alleviate this.
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-provider-netbird",
LeaderElectionID: "crossplane-leader-election-netbird-crossplane-provider",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(),
RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(),
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/crossplane/provider-netbird
module github.com/crossplane/netbird-crossplane-provider
go 1.23.0
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/resource"
ctrl "sigs.k8s.io/controller-runtime"
"github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
)
// Setup adds a controller that reconciles ProviderConfigs by accounting for
@@ -34,10 +34,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
nbapi "github.com/netbirdio/netbird/management/server/http/api"
)
+4 -4
View File
@@ -36,10 +36,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/resource"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
"github.com/netbirdio/netbird/management/server/http/api"
)
@@ -35,10 +35,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
"github.com/netbirdio/netbird/management/server/http/api"
)
+4 -4
View File
@@ -35,10 +35,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/resource"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
nbapi "github.com/netbirdio/netbird/management/server/http/api"
)
@@ -37,11 +37,11 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
"github.com/crossplane/provider-netbird/internal/features"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
nbapi "github.com/netbirdio/netbird/management/server/http/api"
)
+4 -4
View File
@@ -29,10 +29,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
nbapi "github.com/netbirdio/netbird/management/server/http/api"
"github.com/pkg/errors"
@@ -29,10 +29,10 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
apisv1alpha1 "github.com/crossplane/provider-netbird/apis/v1alpha1"
"github.com/crossplane/provider-netbird/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/provider-netbird/internal/controller/nb"
"github.com/crossplane/provider-netbird/internal/features"
apisv1alpha1 "github.com/crossplane/netbird-crossplane-provider/apis/v1alpha1"
"github.com/crossplane/netbird-crossplane-provider/apis/vpn/v1alpha1"
nbcontrol "github.com/crossplane/netbird-crossplane-provider/internal/controller/nb"
"github.com/crossplane/netbird-crossplane-provider/internal/features"
netbird "github.com/netbirdio/netbird/management/client/rest"
nbapi "github.com/netbirdio/netbird/management/server/http/api"
"github.com/pkg/errors"

Some files were not shown because too many files have changed in this diff Show More