Skip to content

Commit

Permalink
Fix all actions (#210)
Browse files Browse the repository at this point in the history
* Fix all actions
- run on public runners
- change event trigger to `pull_request`, it's a public repo
- remove private repo workarounds as git redirect script

* Switch to `ipam.metal.ironcore.dev` API (#211)
  • Loading branch information
damyan authored Mar 14, 2024
1 parent 49f76f6 commit 8922859
Show file tree
Hide file tree
Showing 26 changed files with 82 additions and 121 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Dependabot auto-approve
on: pull_request_target
on: pull_request

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: self-hosted
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: Lint Golang Codebase

on:
pull_request_target:
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
jobs:
golangci:
name: lint
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: ./hack/setup-git-redirect.sh
env:
GITHUB_PAT: ${{ secrets.BOT_PAT }}
- uses: golangci/golangci-lint-action@v4
with:
args: --timeout=15m
4 changes: 2 additions & 2 deletions .github/workflows/kustomize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ on:
- v*
paths:
- 'config/**'
pull_request_target:
pull_request:
paths-ignore:
- 'config/**'

jobs:
kustomize-test:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ on:
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request_target:
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'

permissions:
contents: read
packages: write

jobs:
buildAndPush:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -65,5 +69,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets: |
"github_pat=${{ secrets.BOT_PAT }}"
4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:

jobs:
update_release_draft:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v6
with:
disable-releaser: github.ref != 'refs/heads/main'
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/size-label.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Size Label

on:
pull_request_target:
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: read
pull-requests: write

jobs:
size-label:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: size-label
uses: pascalgn/[email protected]
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,22 @@ on:
paths-ignore:
- '**.md'
- 'deploy/**'
pull_request_target:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
run:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: |
mkdir -p ~/.ssh
for key in rsa ecdsa ed25519; do
ssh-keyscan -t $key github.com 2>/dev/null >> ~/.ssh/known_hosts
done
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- run: ./hack/setup-git-redirect.sh
- run: make build
- run: make test
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ WORKDIR /opt/ipxe
COPY go.mod go.mod
COPY go.sum go.sum

COPY hack/ hack/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN --mount=type=ssh --mount=type=secret,id=github_pat GITHUB_PAT_PATH=/run/secrets/github_pat ./hack/setup-git-redirect.sh \
&& mkdir -p -m 0600 ~/.ssh \
&& ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts \
&& go mod download
RUN go mod download

# Copy the go source
COPY pkg pkg
Expand Down
13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
GOPRIVATE ?= "github.com/onmetal/*"
IMG ?= ipxe-service:latest

ENVTEST_K8S_VERSION ?= 1.25.0
Expand All @@ -7,13 +6,6 @@ ENVTEST_SHA = 44c5d5029cc3c19bf6e7df3f5c5943977a39637c
ARCHITECTURE = amd64
LOCAL_TESTBIN = $(CURDIR)/testbin

GITHUB_PAT_PATH ?=
ifeq (,$(GITHUB_PAT_PATH))
GITHUB_PAT_MOUNT ?=
else
GITHUB_PAT_MOUNT ?= --secret id=github_pat,src=$(GITHUB_PAT_PATH)
endif

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -54,11 +46,8 @@ test: setup-envtest
IPXE_DEFAULT_CONFIGMAP_PATH="../config/samples/ipxe-default-cm" \
go test ./... -coverprofile cover.out

image: test
podman build . -t ${IMG} --build-arg GOPRIVATE=${GOPRIVATE} --build-arg GIT_USER=${GIT_USER} --build-arg GIT_PASSWORD=${GIT_PASSWORD}

docker-build: ## Build docker image with the manager.
docker build -t ${IMG} --build-arg GOPRIVATE=${GOPRIVATE} $(GITHUB_PAT_MOUNT) .
docker build -t ${IMG} --build-arpg .

docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="./docs/assets/logo.png" alt="Logo of the project" align="right">

## Status of the last deployments:
[![Build and Publish Docker Image](https://github.com/onmetal/ipxe-service/actions/workflows/publish-docker.yml/badge.svg)](https://github.com/onmetal/ipxe-service/actions/workflows/publish-docker.yml)
[![Build and Publish Docker Image](https://github.com/ironcore-dev/ipxe-service/actions/workflows/publish-docker.yml/badge.svg)](https://github.com/ironcore-dev/ipxe-service/actions/workflows/publish-docker.yml)

## Overview

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: ips.ipam.onmetal.de
name: ips.ipam.metal.ironcore.dev
spec:
group: ipam.onmetal.de
group: ipam.metal.ironcore.dev
names:
plural: ips
singular: ip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: networks.ipam.onmetal.de
name: networks.ipam.metal.ironcore.dev
spec:
group: ipam.onmetal.de
group: ipam.metal.ironcore.dev
names:
plural: networks
singular: network
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: subnets.ipam.onmetal.de
name: subnets.ipam.metal.ironcore.dev
spec:
group: ipam.onmetal.de
group: ipam.metal.ironcore.dev
names:
plural: subnets
singular: subnet
Expand Down
2 changes: 1 addition & 1 deletion config/default/apiserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
name: ipxe-service
rules:
- apiGroups:
- ipam.onmetal.de
- ipam.metal.ironcore.dev
resources:
- ips
verbs:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ipam/ip1.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: ipam.onmetal.de/v1alpha1
apiVersion: ipam.metal.ironcore.dev/v1alpha1
kind: IP
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ipam/ip2.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: ipam.onmetal.de/v1alpha1
apiVersion: ipam.metal.ironcore.dev/v1alpha1
kind: IP
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ipam/network.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: ipam.onmetal.de/v1alpha1
apiVersion: ipam.metal.ironcore.dev/v1alpha1
kind: Network
metadata:
name: dhcp
Expand Down
4 changes: 2 additions & 2 deletions config/samples/ipam/subnet.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: ipam.onmetal.de/v1alpha1
apiVersion: ipam.metal.ironcore.dev/v1alpha1
kind: Subnet
metadata:
labels:
ipam.onmetal.de/object-purpose: dhcp
ipam.metal.ironcore.dev/object-purpose: dhcp
name: dhcp
namespace: metal-api-system
spec:
Expand Down
2 changes: 1 addition & 1 deletion docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ curl http://127.0.0.1:8082
Here's a brief intro about what a developer must do in order to start developing the project further:

```shell
git clone https://github.com/onmetal/ipxe-service.git
git clone https://github.com/ironcore-dev/ipxe-service.git
cd ipxe-service/
helm install ipxe-service ./chart
```
Expand Down
32 changes: 14 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/onmetal/ipxe-service
module github.com/ironcore-dev/ipxe-service

go 1.21
go 1.22

require (
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/coreos/butane v0.20.0
github.com/gorilla/mux v1.8.1
github.com/ironcore-dev/ipam v0.2.0
github.com/ironcore-dev/metal v0.11.2
github.com/onmetal/ipam v0.0.26
github.com/onsi/ginkgo/v2 v2.16.0
github.com/onsi/gomega v1.31.1
github.com/pkg/errors v0.9.1
Expand All @@ -32,7 +32,7 @@ require (
github.com/coreos/ignition/v2 v2.17.0 // indirect
github.com/coreos/vcontext v0.0.0-20230201181013-d72178a18687 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/emicklei/go-restful/v3 v3.11.3 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
Expand Down Expand Up @@ -60,24 +60,24 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.49.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/vincent-petithory/dataurl v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/tools v0.18.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.32.0 // indirect
Expand All @@ -93,7 +93,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/onmetal/k8s-inventory v0.0.1 => github.com/onmetal/metal-api v0.4.0

replace github.com/onmetal/k8s-machine-requests v0.0.0-20210901134901-3a2a3b92842c => github.com/onmetal/metal-api-gateway v0.4.0
Loading

0 comments on commit 8922859

Please sign in to comment.