Skip to content

Commit

Permalink
Update golang vendor and fix github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Dec 3, 2024
1 parent 3b97664 commit a76653f
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
strategy:
matrix:
go-version: [1.17.x, 1.18.x]
go-version: [1.22.x, 1.23.x]
goarch: [386, amd64, arm, arm64, ppc64le, s390x]
os: [ubuntu-latest] #, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Build container image
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: ghcr.io/${{ github.repository }}:latest-origin
file: Dockerfile.openshift
- name: Download OKD Builder Dockerfile
run: curl https://raw.githubusercontent.com/okd-project/images/main/builder/Dockerfile -o okd-builder.Dockerfile

- name: Create root for builder
run: mkdir root

- name: Organically build golang builder image
run: docker build -t local/okdbuilder:latest -f okd-builder.Dockerfile .

- name: Organically build Multus origin image
run: docker build -t local/multus-cni:latest-origin -f Dockerfile.openshift .
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x, 1.18.x]
go-version: [1.22.x, 1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.o
*.a
*.so
okd-builder.Dockerfile

# Folders
_obj
Expand All @@ -28,5 +29,6 @@ gopath/
.vagrant
.idea
/release-*
root/

*~
11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# This Dockerfile is used to build the image available on DockerHub
FROM centos:centos7 as build
FROM golang:1.23 AS build

# Add everything
ADD . /usr/src/cni-route-override

ENV INSTALL_PKGS "git golang"
RUN rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO && \
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo && \
yum install -y $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
cd /usr/src/cni-route-override && \
RUN cd /usr/src/cni-route-override && \
./build_linux.sh

FROM alpine
LABEL org.opencontainers.image.source https://github.com/redhat-nfvpe/cni-route-override
LABEL org.opencontainers.image.source="https://github.com/redhat-nfvpe/cni-route-override"
COPY --from=build /usr/src/cni-route-override/bin/route-override /
WORKDIR /
14 changes: 7 additions & 7 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# This dockerfile is used for building for OpenShift
FROM openshift/origin-release:golang-1.16 as rhel8
# The okd-builder image is locally built from https://raw.githubusercontent.com/okd-project/images/main/okd-builder.Dockerfile
FROM local/okdbuilder:latest AS builder

ADD . /usr/src/route-override
WORKDIR /usr/src/route-override
ENV CGO_ENABLED=0
ENV VERSION=rhel8 COMMIT=unset
RUN ./build_linux.sh
WORKDIR /

FROM openshift/origin-base
LABEL org.opencontainers.image.source https://github.com/redhat-nfvpe/cni-route-override
COPY --from=rhel8 /usr/src/route-override/bin/route-override /usr/src/route-override/bin/route-override
COPY --from=rhel8 /usr/src/route-override/bin/route-override /usr/src/route-override/rhel8/bin/route-override
FROM quay.io/openshift/origin-base:latest
LABEL org.opencontainers.image.source="https://github.com/redhat-nfvpe/cni-route-override"
COPY --from=builder /usr/src/route-override/bin/route-override /usr/src/route-override/bin/route-override
COPY --from=builder /usr/src/route-override/bin/route-override /usr/src/route-override/rhel8/bin/route-override

LABEL io.k8s.display-name="route override CNI" \
io.k8s.description="This is a component of OpenShift Container Platform and provides a CNI plugin to override routes" \
Expand Down
6 changes: 3 additions & 3 deletions cmd/route-override/route-override.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ type IPAMArgs struct {
}

/*
type RouteOverrideArgs struct {
types.CommonArgs
}
type RouteOverrideArgs struct {
types.CommonArgs
}
*/
func parseConf(data []byte, envArgs string) (*RouteOverrideConfig, error) {

Check warning on line 72 in cmd/route-override/route-override.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

parameter 'envArgs' seems to be unused, consider removing or renaming it as _

Check warning on line 72 in cmd/route-override/route-override.go

View workflow job for this annotation

GitHub Actions / test (1.22.x, ubuntu-latest)

parameter 'envArgs' seems to be unused, consider removing or renaming it as _

Check warning on line 72 in cmd/route-override/route-override.go

View workflow job for this annotation

GitHub Actions / test (1.22.x, ubuntu-latest)

parameter 'envArgs' seems to be unused, consider removing or renaming it as _

Check warning on line 72 in cmd/route-override/route-override.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

parameter 'envArgs' seems to be unused, consider removing or renaming it as _
conf := RouteOverrideConfig{FlushRoutes: false}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/redhat-nfvpe/cni-route-override

go 1.17
go 1.22

require (
github.com/containernetworking/cni v1.1.2
Expand All @@ -14,7 +14,7 @@ require (
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ github.com/vishvananda/netlink/nl
# github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc
## explicit
github.com/vishvananda/netns
# golang.org/x/net v0.0.0-20220722155237-a158d28d115b => golang.org/x/net v0.7.0
# golang.org/x/net v0.31.0 => golang.org/x/net v0.7.0
## explicit; go 1.17
golang.org/x/net/html
golang.org/x/net/html/atom
Expand Down

0 comments on commit a76653f

Please sign in to comment.