From 8b9a05ea68294bd1afccaf1d251e70eefdfc3e41 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 17:07:16 +0800 Subject: [PATCH 1/2] change access permission to default in general. (#1583) Signed-off-by: Tomoya Fujita (cherry picked from commit 95ba3a72fd07cf79bcf772c1f068dbb88bdfb5e6) Co-authored-by: Tomoya Fujita --- pkg/yurtadm/util/kubernetes/kubernetes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/yurtadm/util/kubernetes/kubernetes.go b/pkg/yurtadm/util/kubernetes/kubernetes.go index e9d23b1dd24..8c22ae25650 100644 --- a/pkg/yurtadm/util/kubernetes/kubernetes.go +++ b/pkg/yurtadm/util/kubernetes/kubernetes.go @@ -167,7 +167,7 @@ func CheckAndInstallKubernetesCni(reuseCNIBin bool) error { klog.V(1).Infof("Skip download cni, use already exist file: %s", savePath) } - if err := os.MkdirAll(constants.KubeCniDir, 0600); err != nil { + if err := os.MkdirAll(constants.KubeCniDir, 0755); err != nil { return err } if err := util.Untar(savePath, constants.KubeCniDir); err != nil { @@ -264,7 +264,7 @@ func SetKubeletUnitConfig() error { } } - if err := os.WriteFile(constants.KubeletServiceConfPath, []byte(constants.KubeletUnitConfig), 0600); err != nil { + if err := os.WriteFile(constants.KubeletServiceConfPath, []byte(constants.KubeletUnitConfig), 0640); err != nil { return err } From 9d5c4514eedccbf1a769bd4fcdd7e7d51878ef91 Mon Sep 17 00:00:00 2001 From: rambohe Date: Wed, 12 Jul 2023 09:44:09 +0800 Subject: [PATCH 2/2] feat: add yurtadm binaries release workflow (#1601) --- .github/workflows/ci.yaml | 10 ++-- .../workflows/{release.yaml => registry.yaml} | 2 +- .github/workflows/release-assets.yaml | 43 +++++++++++++++++ .goreleaser.yaml | 46 +++++++++++++++++++ 4 files changed, 95 insertions(+), 6 deletions(-) rename .github/workflows/{release.yaml => registry.yaml} (99%) create mode 100644 .github/workflows/release-assets.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ca8f18a45a..b4558e5bfa4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,7 +23,7 @@ env: jobs: verify: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v2 @@ -31,7 +31,7 @@ jobs: run: make verify golangci-lint: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v2 @@ -48,7 +48,7 @@ jobs: args: -v markdownlint-misspell-shellcheck: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 # this image is build from Dockerfile # https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile container: pouchcontainer/pouchlinter:v0.1.2 @@ -73,7 +73,7 @@ jobs: # bash -c "exit $code"; unit-tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 with: @@ -104,7 +104,7 @@ jobs: fail_ci_if_error: true verbose: true e2e-tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/registry.yaml similarity index 99% rename from .github/workflows/release.yaml rename to .github/workflows/registry.yaml index f25918d7057..7d0332b436b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/registry.yaml @@ -1,4 +1,4 @@ -name: Release +name: Release Images on: push: diff --git a/.github/workflows/release-assets.yaml b/.github/workflows/release-assets.yaml new file mode 100644 index 00000000000..074e08931d6 --- /dev/null +++ b/.github/workflows/release-assets.yaml @@ -0,0 +1,43 @@ +name: Release Assets + +on: + push: + tags: + - "v*" + workflow_dispatch: {} + +permissions: + contents: read + +jobs: + goreleaser: + if: github.repository == 'openyurtio/openyurt' + permissions: + contents: write + actions: read + checks: write + issues: read + packages: write + pull-requests: read + repository-projects: read + statuses: read + runs-on: ubuntu-22.04 + name: goreleaser + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.18 + cache: true + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000000..bd0286b733a --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,46 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +builds: + - id: yurtadm + binary: yurtadm + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + main: ./cmd/yurtadm/yurtadm.go + ldflags: + - -s -w -X github.com/openyurtio/openyurt/pkg/projectinfo.gitVersion={{ .Tag }} -X github.com/openyurtio/openyurt/pkg/projectinfo.gitCommit={{ .ShortCommit }} -X github.com/openyurtio/openyurt/pkg/projectinfo.buildDate={{ .Date }} + env: + - CGO_ENABLED=0 + +archives: + - format: tar.gz + id: yurtadm-tgz + wrap_in_directory: '{{ .Os }}-{{ .Arch }}' + builds: + - yurtadm + name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}' + files: [ LICENSE, README.md ] + - format: zip + id: yurtadm-zip + builds: + - yurtadm + wrap_in_directory: '{{ .Os }}-{{ .Arch }}' + name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}' + files: [ LICENSE, README.md ] + +checksum: + name_template: 'sha256sums.txt' +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj