Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed Mar 15, 2024
1 parent e85612c commit 62a4d19
Show file tree
Hide file tree
Showing 9 changed files with 805 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#

name: Bug report
title: "[bug] bug title "
description: If something isn't working as expected.
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
For better global communication, please write in English.
(为了更好的国际化交流,请您使用英语描述问题。)
You can use ChatGPT to translate your native language into English:
(您可以使用ChatGPT将您的母语翻译成英文。)
- [ChatGPT](https://chat.openai.com/)
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue)
first to see whether the same issue was reported already.
options:
- label: >
I had searched in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue) and found
no similar issues.
required: true
- type: dropdown
attributes:
label: Environment
description: Describe the environment.
options:
- Linux (self-host)
- Mac (self-host)
- Windows (self-host)
- Laf-cli
validations:
required: true

- type: textarea
attributes:
label: What happened
description: Describe what happened.
placeholder: >
A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
attributes:
label: How to reproduce
description: >
Describe the steps to reproduce the bug here.
placeholder: >
Please make sure you provide a reproducible step-by-step case of how to reproduce the problem
as minimally and precisely as possible.
1. xxx
2. xxx
3. ...
validations:
required: true

- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
This is absolutely not required, but we are happy to guide you in the contribution process
especially if you already have a good understanding of how to implement the fix.
options:
- label: Yes I am willing to submit a PR!

- type: markdown
attributes:
value: "Thanks for completing our form!"
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Join Our Discord
url: https://discord.gg/uWZqAwwdvy
about: Join our community, we will keep you in the loop.
- name: Contact US / Business Inquiries
url: https://docs.qq.com/form/page/DS0tCWXpQc2NpR3dR
about: Please contact us.
70 changes: 70 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#

name: Feature Request
title: "[Feature] Feature title "
description: I want to suggest a feature for this project.
labels: [ "feature" ]
body:
- type: markdown
attributes:
value: |
For better global communication, Please write in English.
(为了更好的国际化交流,请您使用英语描述您的问题。)
You can use the following translation tool to translate, but please check the translation carefully after translation to avoid misinterpretation:
(你可以使用以下翻译工具进行翻译,但是翻译完成后请仔细检查译文,以免有错误的理解:)
- [Google Translate](https://translate.google.com/)
- [Baidu Translate](https://fanyi.baidu.com/)
- [YouDao Translate](https://fanyi.baidu.com/)
- ChatGPT
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue)
first to see whether the same issue was reported already.
options:
- label: >
I had searched in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue) and found
no similar issues.
required: true
- type: textarea
attributes:
label: Feature Request
description: Describe the feature.
placeholder: >
First of all: Have you checked the docs,
or GitHub issues whether someone else has already reported your issue?
Maybe the feature already exists?
validations:
required: true

- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
This is absolutely not required, but we are happy to guide you in the contribution process
especially if you already have a good understanding of how to implement the fix.
options:
- label: Yes I am willing to submit a PR!

- type: markdown
attributes:
value: "Thanks for completing our form!"
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#

name: Question
title: "[Question] Question title "
description: I have a question that isn't answered in docs or issue.
labels: [ "question" ]
body:
- type: markdown
attributes:
value: |
For better global communication, Please write in English.
(为了更好的国际化交流,请您使用英语描述您的问题。)
You can use the following translation tool to translate, but please check the translation carefully after translation to avoid misinterpretation:
(你可以使用以下翻译工具进行翻译,但是翻译完成后请仔细检查译文,以免有错误的理解:)
- [Google Translate](https://translate.google.com/)
- [Baidu Translate](https://fanyi.baidu.com/)
- [YouDao Translate](https://fanyi.baidu.com/)
- ChatGPT
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue)
first to see whether the same issue was reported already.
options:
- label: >
I had searched in the [issues](https://github.com/labring/sealaf/issues?q=is%3Aissue) and found
no similar issues.
required: true
- type: textarea
attributes:
label: Question
description: Describe your question.
placeholder: >
Describe your question here :D
validations:
required: true

- type: markdown
attributes:
value: "Thanks for completing our form!"
26 changes: 26 additions & 0 deletions .github/workflows/build-scripts-updated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build-scripts-updated

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "build/**"
- ".github/workflows/build-scripts-updated.yml"
- ".github/workflows/build-sealos-cluster-image.yml"
- "!**/*.md"

concurrency:
group: build-scripts-updated-${{ github.ref }}
cancel-in-progress: true

jobs:
trigger-workflow-build-cluster-image:
runs-on: ubuntu-latest
steps:
- name: trigger cluster image workflow
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-scripts-updated
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "version": "latest"}'
122 changes: 122 additions & 0 deletions .github/workflows/build-sealos-cluster-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: build-sealos-cluster-image

on:
repository_dispatch:
types: [docker_build_success, build-scripts-updated]
workflow_dispatch:

env:
# Common versions
GO_VERSION: "1.19"

concurrency:
group: build-sealos-cluster-image-${{ github.ref }}
cancel-in-progress: true

jobs:
build_cluster_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.ref }}

- name: Prepare
id: prepare
run: |
IMAGE=sealaf
TAG=${{ github.event.client_payload.version }}
echo "tag=${TAG}" >> $GITHUB_ENV
echo "image=${IMAGE}" >> $GITHUB_ENV
- name: Remove builtin docker
run: |
sudo apt-get remove -y moby-engine moby-cli moby-buildx moby-compose
- name: Install sealos
run: |
echo "deb [trusted=yes] https://apt.fury.io/labring/ /" | sudo tee /etc/apt/sources.list.d/labring.list
sudo apt update
sudo apt install sealos=4.1.4
sudo sealos version
- name: Install buildah
run: |
sudo apt remove buildah -y || true
arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)
sudo echo "download buildah in https://github.com/labring/cluster-image/releases/download/depend/buildah.linux.${arch}"
sudo wget -qO "buildah" "https://github.com/labring/cluster-image/releases/download/depend/buildah.linux.${arch}"
sudo chmod a+x buildah
sudo mv buildah /usr/bin
- name: Login GHCR.io
run: |
echo "run: buildah login -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io"
sudo buildah login -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Build cluster image
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ env.image }}
VERSION: ${{ env.tag }}
working-directory: build
run: |
echo $IMAGE:$VERSION
sudo sealos build -t $IMAGE:$VERSION-arm64 --platform linux/arm64 -f Kubefile .
sudo rm -rf registry
sudo sealos build -t $IMAGE:$VERSION-amd64 --platform linux/amd64 -f Kubefile .
sudo sealos images
- name: Push cluster image to ghcr.io
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ env.image }}
VERSION: ${{ env.tag }}
run: |
sudo buildah images
sudo buildah push $IMAGE:$VERSION-amd64
sudo buildah push $IMAGE:$VERSION-arm64
sudo buildah manifest create $IMAGE:$VERSION
sudo buildah manifest add $IMAGE:$VERSION docker://$IMAGE:$VERSION-amd64
sudo buildah manifest add $IMAGE:$VERSION docker://$IMAGE:$VERSION-arm64
sudo buildah manifest push --all $IMAGE:$VERSION docker://$IMAGE:$VERSION
- name: Push cluster image to docker.io
env:
GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/${{ env.image }}
IMAGE: docker.io/${{ secrets.DOCKER_USERNAME }}/${{ env.image }}
VERSION: ${{ env.tag }}
run: |
sudo buildah login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} docker.io
sudo buildah tag $GHCR_IMAGE:$VERSION-amd64 $IMAGE:$VERSION-amd64
sudo buildah tag $GHCR_IMAGE:$VERSION-arm64 $IMAGE:$VERSION-arm64
sudo buildah push $IMAGE:$VERSION-amd64
sudo buildah push $IMAGE:$VERSION-arm64
sudo buildah manifest create $IMAGE:$VERSION
sudo buildah manifest add $IMAGE:$VERSION docker://$IMAGE:$VERSION-amd64
sudo buildah manifest add $IMAGE:$VERSION docker://$IMAGE:$VERSION-arm64
sudo buildah manifest push --all $IMAGE:$VERSION docker://$IMAGE:$VERSION
- name: Renew issue and Sync Images
uses: labring/[email protected]
with:
version: v0.0.8-rc1
env:
GH_TOKEN: "${{ secrets.GH_PAT }}"
SEALOS_TYPE: "issue_renew"
SEALOS_ISSUE_TITLE: "【DaylyReport】 Auto build for sealaf"
SEALOS_ISSUE_BODYFILE: "build/README.md"
SEALOS_ISSUE_LABEL: "dayly-report"
SEALOS_ISSUE_TYPE: "day"
SEALOS_ISSUE_REPO: "labring-actions/cluster-image"
SEALOS_COMMENT_BODY: "/imagesync ghcr.io/${{ github.repository_owner }}/${{ env.image }}:${{ env.tag }}"

# trigger-workflow-e2e:
# needs: [build_cluster_image]
# runs-on: ubuntu-latest
# steps:
# - name: trigger cluster image workflow
# uses: peter-evans/repository-dispatch@v2
# with:
# event-type: cluster_image_build_success
# client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "version": "latest"}'
Loading

0 comments on commit 62a4d19

Please sign in to comment.