-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from yjinjo/v0
Initialize a cfctl project
- Loading branch information
Showing
22 changed files
with
842 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### Category | ||
- [ ] New feature | ||
- [ ] Bug fix | ||
- [ ] Improvement | ||
- [ ] Refactor | ||
- [ ] etc | ||
|
||
### Description | ||
|
||
### Known issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# .github/workflows/check-pull-request.yml | ||
name: Check Pull Request | ||
|
||
on: | ||
pull_request_target: | ||
|
||
jobs: | ||
check-pull-request: | ||
name: Check Pull Request | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Check signed commits | ||
id: review | ||
uses: cloudforet-io/check-pr-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Notify Result | ||
if: ${{ steps.review.outputs.signedoff == 'false' }} | ||
run: | | ||
echo "The review result is ${{ steps.review.outputs.signedoff }}" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "[Dispatch] Create Branch" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch_name: | ||
description: enter branch (release-x.y) | ||
required: true | ||
default: 'release-1.0' | ||
|
||
jobs: | ||
create_branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: create branch | ||
uses: peterjgrainger/action-create-branch@v2.2.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
with: | ||
branch: '${{ github.event.inputs.branch_name }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "[Dispatch] Daily build" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "Nothing to do" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: "[Dispatch] Make Helm Chart" | ||
on: | ||
workflow_dispatch: | ||
repository_dispatch: | ||
types: [make_helm_chart] | ||
|
||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
jobs: | ||
helm_cloudforet: | ||
if: github.repository_owner == 'cloudforet-io' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: '3.4.0' | ||
|
||
- name: Run Helm packaging | ||
run: | | ||
export cache_dir=/tmp/helm | ||
mkdir -p "$cache_dir" | ||
echo "Installing chart-releaser..." | ||
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.2.0/chart-releaser_1.2.0_linux_amd64.tar.gz" | ||
tar -xzf cr.tar.gz -C "$cache_dir" | ||
rm -f cr.tar.gz | ||
echo 'Adding cr directory to PATH...' | ||
export PATH="$cache_dir:$PATH" | ||
rm -rf .deploy | ||
echo 'Print Version ...' | ||
export SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2) | ||
echo 'Update helm version in chart.yaml and values.yaml' | ||
echo "SERVICE=${SERVICE}" >> $GITHUB_ENV | ||
helm package deploy/helm --destination .deploy | ||
cr upload -o cloudforet-io -r charts -p .deploy --token ${{ secrets.PAT_TOKEN }} | ||
cr index -i ./index.yaml -p .deploy/ -o cloudforet-io -r charts -c https://cloudforet-io.github.io/charts --token ${{ secrets.PAT_TOKEN }} | ||
cp index.yaml /tmp/index.yaml | ||
- name: Check out chart repo | ||
uses: actions/checkout@master | ||
with: | ||
repository: cloudforet-io/charts | ||
ref: gh-pages | ||
token: ${{ secrets.PAT_TOKEN }} | ||
|
||
- name: Update Helm repository index.yaml | ||
run: | | ||
git config --global user.email admin@cloudforet.io | ||
git config --global user.name cloudforet-admin | ||
cp /tmp/index.yaml ./ | ||
git add index.yaml | ||
git pull | ||
git commit -m "Add ${SERVICE} chart" | ||
git push origin gh-pages | ||
- name: Notice when job fails | ||
if: failure() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,workflow,job | ||
author_name: Github Action Slack | ||
|
||
notify_to_slack: | ||
if: github.repository_owner == 'cloudforet-io' | ||
needs: helm_cloudforet | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Slack | ||
if: always() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
author_name: Github Action Slack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: "[Dispatch] Release" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'enter version(x.y.z)' | ||
required: true | ||
default: '2.0.0' | ||
container_arch: | ||
type: choice | ||
description: 'choose container architecture' | ||
default: linux/amd64 | ||
options: | ||
- "linux/amd64" | ||
- "linux/amd64,linux/arm64" | ||
|
||
|
||
env: | ||
ARCH: ${{ github.event.inputs.container_arch }} | ||
VERSION: ${{ github.event.inputs.version }} | ||
PACKAGE_VERSION: ${{ github.event.inputs.version }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
jobs: | ||
tagging: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
|
||
- name: tagging | ||
run: | | ||
git config user.email admin@cloudforet.io | ||
git config user.name cloudforet-admin | ||
git tag ${{ env.VERSION }} | ||
git push origin ${{ env.VERSION }} | ||
- name: Notice when job fails | ||
if: failure() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,workflow,job | ||
author_name: Github Action Slack | ||
|
||
pypi: | ||
needs: tagging | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
|
||
- name: Set python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Make all and Packaging | ||
run: | | ||
cd src | ||
python setup.py sdist bdist_wheel | ||
- name: Publish a Python distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
verbose: true | ||
packages-dir: src/dist/ | ||
|
||
- name: Notice when job fails | ||
if: failure() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,workflow,job | ||
author_name: Github Action Slack | ||
|
||
docker: | ||
needs: pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.CLOUDFORET_DEV_DOCKER_USERNAME }} | ||
password: ${{ secrets.CLOUDFORET_DEV_DOCKER_PASSWORD }} | ||
|
||
- name: Build and push to dockerhub | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ env.ARCH }} | ||
push: true | ||
tags: cloudforet/${{ github.event.repository.name }}:${{ env.VERSION }} | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.ECR_REPO }} | ||
|
||
- name: Build and push to ECR | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ env.ARCH }} | ||
push: true | ||
tags: ${{ secrets.ECR_REPO }}/${{ github.event.repository.name }}:${{ env.VERSION }} | ||
|
||
- name: Notice when job fails | ||
if: failure() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,workflow,job | ||
author_name: Github Action Slack | ||
|
||
notification: | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Slack | ||
if: always() | ||
uses: 8398a7/action-slack@v3.15.0 | ||
with: | ||
status: ${{job.status}} | ||
fields: repo,message,commit,author,action,ref,workflow,job | ||
author_name: Github Action Slack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "[Dispatch] Sync CI" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REPO: cloudforet-io/actions | ||
WORKFLOW_NAME: dispatch_apply_workflows.yaml | ||
|
||
jobs: | ||
owner_check: | ||
if: github.repository_owner == 'cloudforet-io' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo ${{ github.repository_owner }} | ||
pull_workflows: | ||
runs-on: ubuntu-latest | ||
needs: owner_check | ||
steps: | ||
- name: request workflows | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
repo: ${{ env.REPO }} | ||
workflow: ${{ env.WORKFLOW_NAME }} | ||
inputs: '{"dest" : "${{ github.event.repository.name }}"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: "[PR Open] example" | ||
|
||
on: | ||
pull_request: | ||
types: [opened] | ||
|
||
jobs: | ||
example: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "Implement here with test codes!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
Oops, something went wrong.