Skip to content

Commit

Permalink
Merge pull request #361 from Abirdcfly/main
Browse files Browse the repository at this point in the history
chore: update github action && add docker go proxy auto config
  • Loading branch information
bjwswang authored Dec 13, 2023
2 parents d5039c6 + 37861fd commit 121f7e3
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 30 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/example_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
LOG_DIR: "/tmp/kubeagi-example-test/logs"
GOPROXY: https://proxy.golang.org/,direct

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand All @@ -26,7 +27,7 @@ jobs:
key: operator.image-${{ github.sha }}
path: /tmp/operator.image.tar
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
# It would be foolish to add the same judgment over and over again, but GitHub action currently does not have
# the syntax to skip all the next steps unless we let the pre step fail, and failure is not what we want.
# see https://github.com/actions/runner/issues/662
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
matrix:
no: [1, 2, 3]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download operator image from cache
uses: actions/cache/restore@v3
with:
Expand Down Expand Up @@ -89,11 +90,3 @@ jobs:
with:
name: ${{ github.sha }}-${{ matrix.no }}.logs
path: ${{ env.LOG_DIR }}
- name: Upload component images to cache
if: ${{ env.UPLOAD_IMAGE == 'YES' }}
uses: actions/cache/save@v3
with:
key: component-image-cache-${{ github.sha }}
path: |
/home/runner/work/kubeagi/kubeagi/tmp/images/
/home/runner/work/kubeagi/kubeagi/tmp/all.image.list
4 changes: 4 additions & 0 deletions .github/workflows/graphql_sdk_generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'graphql-server/go-server/graph/schema/*.gql'
workflow_dispatch:

env:
GOPROXY: https://proxy.golang.org/,direct


jobs:
image:
runs-on: ubuntu-latest
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ on:
env:
GO_VER: 1.20
GO_TAGS: ""
GOPROXY: https://proxy.golang.org/,direct

jobs:
image:
if: github.repository == 'kubeagi/arcadia'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Variable
Expand All @@ -28,25 +29,25 @@ jobs:
- name: Show Variable
run: echo "varibables ${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Login to the dockerhub Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: benjlevesque/short-sha@v2.1
- uses: benjlevesque/short-sha@v2.2
name: Get short commit sha
id: short-sha
- name: Build and push
id: push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
Expand All @@ -62,8 +63,9 @@ jobs:
GO_TAGS=${{ env.GO_TAGS }}
BUILD_ID=${{ env.SEMREV_LABEL }}
BUILD_DATE=${{ env.BUILD_DATE }}
GOPROXY=${{ env.GOPROXY }}
- name: Build data processing image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./data-processing
file: ./data-processing/Dockerfile
Expand All @@ -73,4 +75,4 @@ jobs:
kubeagi/data-processing:${{ steps.set-env.outputs.TAG }}
kubeagi/data-processing:v${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }}
kubeagi/data-processing:${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }}
push: true
push: true
6 changes: 3 additions & 3 deletions .github/workflows/lint_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -16,13 +16,13 @@ jobs:
with:
version: v3.11.2

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.0
uses: helm/chart-testing-action@v2

- name: Run chart-testing (list-changed)
id: list-changed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Download all Go modules
Expand All @@ -44,9 +44,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Restore go build cache
Expand All @@ -68,9 +68,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run golangci-lint
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Build the manager binary
FROM golang:1.20 as builder

ARG GOPROXY=https://goproxy.cn,direct
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# 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 go env -w GOPROXY=${GOPROXY}
RUN go mod download

# Copy the go source
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ endif

# Image URL to use all building/pushing image targets
IMG ?= controller:latest

# GOPROXY is the proxy url to be used by go mod
GOPROXY ?= https://goproxy.cn,direct

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.24.2

Expand Down Expand Up @@ -117,7 +121,7 @@ run: manifests generate fmt vet ## Run a controller from your host.

.PHONY: docker-build
docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .
docker build -t ${IMG} --build-arg GOPROXY=${GOPROXY} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down

0 comments on commit 121f7e3

Please sign in to comment.