-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CircleCI, GitHub Workflows and CHANGELOG (#1)
- Loading branch information
Showing
17 changed files
with
878 additions
and
7 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,112 @@ | ||
version: 2.1 | ||
orbs: | ||
architect: giantswarm/[email protected] | ||
|
||
jobs: | ||
unit-tests: | ||
executor: architect/architect | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Run unit tests" | ||
command: CGO_ENABLED=0 make test-unit | ||
integration-tests: | ||
executor: architect/machine | ||
machine: | ||
image: 'ubuntu-2004:202010-01' | ||
steps: | ||
- checkout | ||
- architect/machine-install-go | ||
- run: | ||
name: Install Docker Compose | ||
environment: | ||
COMPOSE_VERSION: '1.29.2' | ||
command: | | ||
curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o ~/docker-compose | ||
chmod +x ~/docker-compose | ||
sudo mv ~/docker-compose /usr/bin/docker-compose | ||
- run: | ||
name: "Run integration tests" | ||
command: | | ||
CGO_ENABLED=0 make test-integration | ||
workflows: | ||
package-and-push-chart-on-tag: | ||
jobs: | ||
- unit-tests: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
- integration-tests: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
- architect/go-build: | ||
context: architect | ||
name: go-build | ||
binary: teleport-operator | ||
resource_class: xlarge | ||
requires: | ||
- unit-tests | ||
- integration-tests | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
- architect/push-to-docker: | ||
context: "architect" | ||
name: push-teleport-operator-to-quay | ||
image: "quay.io/giantswarm/teleport-operator" | ||
username_envar: "QUAY_USERNAME" | ||
password_envar: "QUAY_PASSWORD" | ||
requires: | ||
- go-build | ||
filters: | ||
# Trigger the job also on git tag. | ||
tags: | ||
only: /^v.*/ | ||
|
||
- architect/push-to-docker: | ||
context: "architect" | ||
name: push-teleport-operator-to-docker | ||
image: "docker.io/giantswarm/teleport-operator" | ||
username_envar: "DOCKER_USERNAME" | ||
password_envar: "DOCKER_PASSWORD" | ||
requires: | ||
- go-build | ||
# Needed to trigger job also on git tag. | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
- architect/push-to-app-catalog: | ||
context: "architect" | ||
# executor: "app-build-suite" # uncomment this if you want automatic metadata generation and helm chart linting | ||
name: push-to-app-catalog | ||
app_catalog: "control-plane-catalog" | ||
app_catalog_test: "control-plane-test-catalog" | ||
chart: "teleport-operator" | ||
requires: | ||
- push-teleport-operator-to-quay | ||
- push-teleport-operator-to-docker | ||
# Trigger job on git tag. | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
- architect/push-to-app-collection: | ||
context: architect | ||
name: push-to-capa-app-collection | ||
app_name: "teleport-operator" | ||
app_collection_repo: "capa-app-collection" | ||
requires: | ||
- push-teleport-operator-to-docker | ||
- push-teleport-operator-to-quay | ||
- push-to-app-catalog | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /^v.*/ |
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,6 @@ | ||
### What this PR does / why we need it | ||
|
||
|
||
### Checklist | ||
|
||
- [ ] Update changelog in CHANGELOG.md. |
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: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18.4" | ||
- name: Install goimports | ||
run: | | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
- name: Install golangci-lint | ||
env: | ||
GOLANGCI_LINT_VERSION: "v1.47.2" | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ | ||
sudo sh -s -- -b $GOPATH/bin ${GOLANGCI_LINT_VERSION} | ||
- uses: pre-commit/[email protected] |
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/master/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/master/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/master/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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# [email protected] | ||
# | ||
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) | ||
|
||
jobs: | ||
check: | ||
name: 'validate values.yaml against values.schema.json' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- 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 | ||
- name: 'Check if values.yaml is a valid instance of values.schema.json' | ||
run: | | ||
HELM_DIR=$(git diff --name-only origin/${GITHUB_BASE_REF} ${GITHUB_SHA} \ | ||
| grep 'helm/[-a-z].*\/' | head -1 | awk -F '/' '{print $1"/"$2}') | ||
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 | ||
${HOME}/yajsv -s ${HELM_DIR}/values.schema.json ${VALUES} |
Oops, something went wrong.