This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f06dd08
commit ed34aa6
Showing
14 changed files
with
356 additions
and
96 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
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,53 @@ | ||
name: Add appropriate labels to issue | ||
|
||
on: | ||
issues: | ||
types: [assigned] | ||
|
||
jobs: | ||
build_user_list: | ||
name: Get yaml config of GS users | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get user-mapping | ||
run: | | ||
mkdir -p artifacts | ||
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \ | ||
-O artifacts/users.yaml \ | ||
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/user-mapping.yaml | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: users | ||
path: artifacts/users.yaml | ||
retention-days: 1 | ||
|
||
add_label: | ||
name: Add team label when assigned | ||
runs-on: ubuntu-latest | ||
needs: build_user_list | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
id: download-users | ||
with: | ||
name: users | ||
- name: Find team label based on user names | ||
run: | | ||
event_assignee=$(cat $GITHUB_EVENT_PATH | jq -r .assignee.login | tr '[:upper:]' '[:lower:]') | ||
echo "Issue assigned to: ${event_assignee}" | ||
TEAMS=$(cat ${{steps.download-users.outputs.download-path}}/users.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_assignee}.teams" -o csv | tr ',' ' ') | ||
echo "LABEL<<EOF" >> $GITHUB_ENV | ||
for team in ${TEAMS}; do | ||
echo "Team: ${team} | Label: team/${team}" | ||
echo "team/${team}" >> $GITHUB_ENV | ||
done | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Apply label to issue | ||
if: ${{ env.LABEL != '' }} | ||
uses: actions-ecosystem/action-add-labels@v1 | ||
with: | ||
github_token: ${{ secrets.ISSUE_AUTOMATION }} | ||
labels: | | ||
${{ env.LABEL }} |
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,89 @@ | ||
name: Add Issue to Project when assigned | ||
|
||
on: | ||
issues: | ||
types: | ||
- assigned | ||
- labeled | ||
|
||
jobs: | ||
build_user_list: | ||
name: Get yaml config of GS users | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get user-mapping | ||
run: | | ||
mkdir -p artifacts | ||
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \ | ||
-O artifacts/users.yaml \ | ||
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/user-mapping.yaml | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: users | ||
path: artifacts/users.yaml | ||
retention-days: 1 | ||
- name: Get label-mapping | ||
run: | | ||
mkdir -p artifacts | ||
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \ | ||
-O artifacts/labels.yaml \ | ||
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/label-mapping.yaml | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: labels | ||
path: artifacts/labels.yaml | ||
retention-days: 1 | ||
|
||
add_to_personal_board: | ||
name: Add issue to personal board | ||
runs-on: ubuntu-latest | ||
needs: build_user_list | ||
if: github.event.action == 'assigned' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
id: download-users | ||
with: | ||
name: users | ||
- name: Find personal board based on user names | ||
run: | | ||
event_assignee=$(cat $GITHUB_EVENT_PATH | jq -r .assignee.login | tr '[:upper:]' '[:lower:]') | ||
echo "Issue assigned to: ${event_assignee}" | ||
BOARD=($(cat ${{steps.download-users.outputs.download-path}}/users.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_assignee}.personalboard")) | ||
echo "Personal board URL: ${BOARD}" | ||
echo "BOARD=${BOARD}" >> $GITHUB_ENV | ||
- name: Add issue to personal board | ||
if: ${{ env.BOARD != 'null' && env.BOARD != '' }} | ||
uses: actions/add-to-project@main | ||
with: | ||
project-url: ${{ env.BOARD }} | ||
github-token: ${{ secrets.ISSUE_AUTOMATION }} | ||
|
||
add_to_team_board: | ||
name: Add issue to team board | ||
runs-on: ubuntu-latest | ||
needs: build_user_list | ||
if: github.event.action == 'labeled' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
id: download-labels | ||
with: | ||
name: labels | ||
- name: Find team board based on label | ||
run: | | ||
event_label=$(cat $GITHUB_EVENT_PATH | jq -r .label.name | tr '[:upper:]' '[:lower:]') | ||
echo "Issue labelled with: ${event_label}" | ||
BOARD=($(cat ${{steps.download-labels.outputs.download-path}}/labels.yaml | tr '[:upper:]' '[:lower:]' | yq ".[\"${event_label}\"].projectboard")) | ||
echo "Team board URL: ${BOARD}" | ||
echo "BOARD=${BOARD}" >> $GITHUB_ENV | ||
- name: Add issue to team board | ||
if: ${{ env.BOARD != 'null' && env.BOARD != '' }} | ||
uses: actions/add-to-project@main | ||
with: | ||
project-url: ${{ env.BOARD }} | ||
github-token: ${{ secrets.ISSUE_AUTOMATION }} |
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 |
---|---|---|
@@ -1,46 +1,53 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl@5.3.0 | ||
# devctl@6.7.0 | ||
# | ||
name: 'Check if values schema file has been updated' | ||
on: pull_request | ||
name: 'Values and schema' | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
paths: | ||
- 'helm/**/values.yaml' # default helm chart values | ||
- 'helm/**/values.schema.json' # schema | ||
- 'helm/**/ci/ci-values.yaml' # overrides for CI (can contain required entries) | ||
|
||
push: {} | ||
|
||
jobs: | ||
check: | ||
name: 'Check values.yaml and its schema in PR' | ||
name: 'validate values.yaml against values.schema.json' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: 'Check if values.schema.json was updated' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
VALUES_FILE_CHANGED="false" | ||
SCHEMA_FILE_CHANGED="false" | ||
echo "Comparing ${GITHUB_BASE_REF}...${GITHUB_HEAD_REF}" | ||
with: | ||
fetch-depth: 0 | ||
|
||
changed_files=$(gh api "repos/{owner}/{repo}/compare/${GITHUB_BASE_REF}...${GITHUB_HEAD_REF}" --jq ".files[] | .filename") | ||
if grep -q "values.schema.json" <<< $(git ls-tree -r --name-only ${GITHUB_SHA}); then | ||
- name: Install validator | ||
run: | | ||
wget -q -O ${HOME}/yajsv https://github.com/neilpa/yajsv/releases/download/v1.4.1/yajsv.linux.amd64 | ||
chmod +x ${HOME}/yajsv | ||
if grep -q "values.yaml" <<< "${changed_files}" ; then | ||
VALUES_FILE_CHANGED="true" | ||
fi | ||
- name: 'Check if values.yaml is a valid instance of values.schema.json' | ||
run: | | ||
for chart_yaml in helm/*/Chart.yaml; do | ||
helm_dir="${chart_yaml%/Chart.yaml}" | ||
if grep -q "values.schema.json" <<< "${changed_files}" ; then | ||
SCHEMA_FILE_CHANGED="true" | ||
if [ ! -f ${helm_dir}/values.schema.json ]; then | ||
echo "Skipping validation for '${helm_dir}' folder, because 'values.schema.json' does not exist..." | ||
continue | ||
fi | ||
if [ $VALUES_FILE_CHANGED != $SCHEMA_FILE_CHANGED ]; then | ||
echo "FAILED: values.yaml was updated but values.schema.json hasn't been regenerated" | ||
echo "Please refer to this document: https://intranet.giantswarm.io/docs/organizational-structure/teams/cabbage/app-updates/helm-values-schema/" | ||
exit 1 | ||
values=${helm_dir}/values.yaml | ||
if [ -f ${helm_dir}/ci/ci-values.yaml ]; then | ||
# merge ci-values.yaml into values.yaml (providing required values) | ||
echo -e "\nMerged values:\n==============" | ||
yq '. *= load("'${helm_dir}'/ci/ci-values.yaml")' ${helm_dir}/values.yaml | tee ${helm_dir}/combined-values.yaml | ||
echo -e "\n==============\n" | ||
values=${helm_dir}/combined-values.yaml | ||
fi | ||
echo "PASSED: values.yaml and values.schema.json both appear to have been updated" | ||
exit 0 | ||
fi | ||
echo "INFO: values.schema.json not present in this repo - nothing to do" | ||
${HOME}/yajsv -s ${helm_dir}/values.schema.json ${values} | ||
done |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl@5.3.0 | ||
# devctl@6.7.0 | ||
# | ||
name: Create Release | ||
on: | ||
|
@@ -15,7 +15,7 @@ on: | |
jobs: | ||
debug_info: | ||
name: Debug info | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Print github context JSON | ||
run: | | ||
|
@@ -24,7 +24,7 @@ jobs: | |
EOF | ||
gather_facts: | ||
name: Gather facts | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
project_go_path: ${{ steps.get_project_go_path.outputs.path }} | ||
ref_version: ${{ steps.ref_version.outputs.refversion }} | ||
|
@@ -50,7 +50,7 @@ jobs: | |
fi | ||
version="${version#v}" # Strip "v" prefix. | ||
echo "version=\"${version}\"" | ||
echo "::set-output name=version::${version}" | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
- name: Checkout code | ||
if: ${{ steps.get_version.outputs.version != '' }} | ||
uses: actions/checkout@v3 | ||
|
@@ -63,7 +63,7 @@ jobs: | |
path='' | ||
fi | ||
echo "path=\"$path\"" | ||
echo "::set-output name=path::${path}" | ||
echo "path=${path}" >> $GITHUB_OUTPUT | ||
- name: Check if reference version | ||
id: ref_version | ||
run: | | ||
|
@@ -81,21 +81,21 @@ jobs: | |
refversion=true | ||
fi | ||
echo "refversion =\"${refversion}\"" | ||
echo "::set-output name=refversion::${refversion}" | ||
echo "refversion=${refversion}" >> $GITHUB_OUTPUT | ||
update_project_go: | ||
name: Update project.go | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
if: ${{ needs.gather_facts.outputs.version != '' && needs.gather_facts.outputs.project_go_path != '' && needs.gather_facts.outputs.ref_version != 'true' }} | ||
needs: | ||
- gather_facts | ||
steps: | ||
- name: Install architect | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "architect" | ||
version: "6.1.0" | ||
version: "6.11.0" | ||
- name: Install semver | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "semver" | ||
version: "3.2.0" | ||
|
@@ -114,28 +114,30 @@ jobs: | |
version="${{ needs.gather_facts.outputs.version }}" | ||
new_version="$(semver bump patch $version)-dev" | ||
echo "version=\"$version\" new_version=\"$new_version\"" | ||
echo "::set-output name=new_version::${new_version}" | ||
echo "new_version=${new_version}" >> $GITHUB_OUTPUT | ||
sed -Ei "s/(version[[:space:]]*=[[:space:]]*)\"${version}\"/\1\"${new_version}\"/" $file | ||
if git diff --exit-code $file ; then | ||
echo "error: no changes in \"$file\"" >&2 | ||
exit 1 | ||
fi | ||
- name: Set up git identity | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "taylorbot" | ||
- name: Commit changes | ||
run: | | ||
file="${{ needs.gather_facts.outputs.project_go_path }}" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add $file | ||
git commit -m "Bump version to ${{ steps.update_project_go.outputs.new_version }}" | ||
- name: Push changes | ||
env: | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git" | ||
branch: "${{ github.ref }}-version-bump" | ||
run: | | ||
git push "${REMOTE_REPO}" HEAD:${{ env.branch }} | ||
- name: Create PR | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
base: "${{ github.ref }}" | ||
branch: "${{ github.ref }}-version-bump" | ||
version: "${{ needs.gather_facts.outputs.version }}" | ||
|
@@ -144,7 +146,7 @@ jobs: | |
hub pull-request -f -m "${{ env.title }}" -b ${{ env.base }} -h ${{ env.branch }} -r ${{ github.actor }} | ||
create_release: | ||
name: Create release | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- gather_facts | ||
if: ${{ needs.gather_facts.outputs.version }} | ||
|
@@ -167,35 +169,38 @@ jobs: | |
with: | ||
version: ${{ needs.gather_facts.outputs.version }} | ||
path: ./CHANGELOG.md | ||
- name: Set up git identity | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "taylorbot" | ||
- name: Create tag | ||
run: | | ||
version="${{ needs.gather_facts.outputs.version }}" | ||
git config --local user.name "github-actions" | ||
git tag "v$version" ${{ github.sha }} | ||
- name: Push tag | ||
env: | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git" | ||
run: | | ||
git push "${REMOTE_REPO}" --tags | ||
- name: Create release | ||
id: create_gh_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
with: | ||
body: ${{ steps.changelog_reader.outputs.changes }} | ||
tag_name: "v${{ needs.gather_facts.outputs.version }}" | ||
release_name: "v${{ needs.gather_facts.outputs.version }}" | ||
|
||
create-release-branch: | ||
name: Create release branch | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- gather_facts | ||
if: ${{ needs.gather_facts.outputs.version }} | ||
steps: | ||
- name: Install semver | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "semver" | ||
version: "3.0.0" | ||
|
Oops, something went wrong.