Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
  • Loading branch information
zaharidichev committed Mar 6, 2024
1 parent 21dce30 commit b1057a2
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 70 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Actions

on:
pull_request:
paths:
- .devcontainer/devcontainer.json
- .github/workflows/**
- justfile
on: workflow_dispatch


permissions:
contents: read
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/cni-plugin-integration.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
name: cni-plugin-integration

on:
workflow_dispatch:
pull_request:
paths:
- Dockerfile-cni-plugin
- cni-plugin/integration/flannel/Dockerfile-tester
- cni-plugin/integration/run.sh
- cni-plugin/**
- cni-repair-controller/**
- justfile*
on: workflow_dispatch


jobs:
cni-flannel-test:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: Go

on:
pull_request:
paths:
- .github/workflows/go.yml
- '**/*.go'
- go.sum
- justfile
on: workflow_dispatch


permissions:
contents: read
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
name: Integration tests

on:
pull_request:
paths:
- .github/workflows/integration.yml
- Dockerfile
- go.mod
- go.sum
- justfile
- proxy-init/**
on: workflow_dispatch


jobs:
proxy-init-integration:
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ name: Markdown
permissions:
contents: read

on:
pull_request:
paths:
- '**/*.md'
- .github/workflows/markdown.yml
on: workflow_dispatch


jobs:
md-lint:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/release-cni-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: cni-plugin release

on:
pull_request:
paths:
- .github/workflows/release-cni-plugin.yml
push:
tags: ["cni-plugin/v*"]
on: workflow_dispatch


permissions:
contents: read
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/release-cni-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: cni-win release

on:
pull_request:
paths:
- .github/workflows/release-cni-win.yml

permissions:
contents: read

jobs:
meta:
timeout-minutes: 3
runs-on: windows-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: meta
uses: ./.github/actions/version-mode
with:
package: cni-win
outputs:
repo: ${{ steps.meta.outputs.repo }}
mode: ${{ steps.meta.outputs.mode }}
version: ${{ steps.meta.outputs.version }}

docker-publish:
needs: meta
runs-on: windows-latest
timeout-minutes: 25
permissions:
id-token: write # needed for signing the images with GitHub OIDC token
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- run: |
docker build -f Dockerfile-cni-plugin-win . --platform windows/amd64
8 changes: 2 additions & 6 deletions .github/workflows/release-proxy-init.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Proxy-init release

on:
pull_request:
paths:
- .github/workflows/release-proxy-init.yml
push:
tags: ["proxy-init/v*"]
on: workflow_dispatch


permissions:
contents: read
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/release-validator.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Validator release

on:
pull_request:
paths:
- .github/workflows/release-validator.yml
push:
tags: ["validator/v*"]
on: workflow_dispatch


permissions:
contents: read
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
name: Rust

on:
pull_request:
paths:
- .github/workflows/rust.yml
- '**/*.rs'
- '**/Cargo.toml'
- Cargo.lock
- deny.toml
- justfile
on: workflow_dispatch


jobs:
check:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ name: Shell
permissions:
contents: read

on:
pull_request:
paths:
- '**/*.sh'
- .github/workflows/shellcheck.yml
- justfile
on: workflow_dispatch

jobs:
sh-lint:
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile-cni-plugin-win
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# syntax=docker/dockerfile:1.4
ARG ARCH
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS go
WORKDIR /build
COPY --link go.mod go.sum ./
COPY --link ./cni-win ./cni-win
RUN go mod download
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=windows GOARCH=$TARGETARCH GO111MODULE=on \
go build -o /go/bin/cni-win -mod=readonly -ldflags "-s -w" -v ./cni-win/

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY --from=go /go/bin/cni-win /go/bin/cni-win
ENTRYPOINT [ "/go/bin/win-cni" ]
52 changes: 52 additions & 0 deletions cni-win/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2017 CNI authors
// Modifications copyright (c) Linkerd authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file was inspired by:
// 1) https://github.com/istio/cni/blob/c63a509539b5ed165a6617548c31b686f13c2133/cmd/istio-cni/main.go

package main

import (
"os"

"github.com/containernetworking/cni/pkg/skel"
"github.com/containernetworking/cni/pkg/version"

"github.com/sirupsen/logrus"
)

func main() {
// Must log to Stderr because the CNI runtime uses Stdout as its state
logrus.SetOutput(os.Stderr)
skel.PluginMain(cmdAdd, cmdCheck, cmdDel, version.All, "")
}

// cmdAdd is called by the CNI runtime for ADD requests
func cmdAdd(args *skel.CmdArgs) error {
logrus.Infof("Got an add for container: %s", args.ContainerID)

return nil
}

func cmdCheck(_ *skel.CmdArgs) error {
logrus.Info("linkerd-cni: check called but not implemented")
return nil
}

// cmdDel is called for DELETE requests
func cmdDel(_ *skel.CmdArgs) error {
logrus.Info("linkerd-cni: delete called but not implemented")
return nil
}

0 comments on commit b1057a2

Please sign in to comment.