Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource value in ledger deploy template #4

Merged
merged 6 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions .github/workflows/build.yml

This file was deleted.

187 changes: 187 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: 'Build and Deploy'

on:
push:
paths:
- 'helm/**'
- 'go/**'
- 'docker/**'
branches:
- master
pull_request:
paths:
- 'helm/**'
- 'helm/**'
- 'go/**'
- 'docker/**'

env:
GCP_REGION: europe-west2
GCP_CLUSTER: ocvab-cluster-model-adder

jobs:
build:
name: 'build'
runs-on: ubuntu-latest
defaults:
run:
working-directory: go
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Install yq
run: |
sudo wget -O /usr/local/bin/yq \
https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq

- name: Bump version and push
id: new_version
uses: anothrNick/github-tag-action@1.22.0
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: patch
DRY_RUN: true

- name: Build Ledger Image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: yoink00/ledger
dockerfile: docker/ledger/Dockerfile
path: go
build_args: GIT_COMMIT_ID=${{ github.sha }}
tag_with_ref: true
tags: ${{ steps.new_version.outputs.new_tag }}
tag_with_sha: false
push: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}

- name: Build Txnsim Image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: yoink00/txnsim
dockerfile: docker/txnsim/Dockerfile
path: go
build_args: GIT_COMMIT_ID=${{ github.sha }}
tag_with_ref: true
tags: ${{ steps.new_version.outputs.new_tag }}
tag_with_sha: false
push: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}

- name: Update versions in charts
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
working-directory: helm
env:
RELEASE_VERSION: ${{ steps.new_version.outputs.new_tag }}
run: |
git config --global user.email "noreply@opencredo.com"
git config --global user.name "Robot Overlord"

# Update main Chart versions
yq write --inplace vab/Chart.yaml version $RELEASE_VERSION
yq write --inplace vab/Chart.yaml appVersion $RELEASE_VERSION
yq write --inplace vab/Chart.yaml "dependencies.(tags.*==local).version" $RELEASE_VERSION
git add vab/Chart.yaml

# Update version in service specific charts
for f in local/*; do
yq write --inplace $f/Chart.yaml version $RELEASE_VERSION
yq write --inplace $f/Chart.yaml appVersion $RELEASE_VERSION
yq write --inplace $f/values.yaml image.tag $RELEASE_VERSION
git add $f/Chart.yaml
git add $f/values.yaml
done

git commit -m "Update Helm versions to $RELEASE_VERSION"
git push

- name: Bump version and push
uses: anothrNick/github-tag-action@1.22.0
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: patch
helm:
name: 'Helm'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Helm
uses: azure/setup-helm@v1

- name: Setup gcloud
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT }}
project_id: ${{ secrets.GCP_PROJECT_ID }}

- name: Get Kubeconfig
run: gcloud container clusters get-credentials "$GCP_CLUSTER" --region "$GCP_REGION"

- name: Helm Lint
run: |
helm lint vab
for f in local/*; do
helm lint $f
done
working-directory: helm

- name: Helm repos
run: |
helm repo add linkerd https://helm.linkerd.io/stable

- name: Install or upgrade Chart
working-directory: helm
run: |
mkdir -p vab/charts
cp -r local/* vab/charts
helm dependency update vab
release_name=$(helm list -o json | jq '.[] | select(.chart != null) | select(.chart | startswith("vab")) | .name' -r | head -1)

FLAG=""
REDIRECT="/dev/stdout"
if [[ -z "$DRY_RUN" || "$DRY_RUN" == "true" ]]; then
FLAG="--dry-run"
REDIRECT="/dev/null"
fi

if [[ -z "$release_name" ]]; then
echo "Installing VAB chart: $FLAG"
helm install vab $FLAG -g \
--set "linkerd2.global.identityTrustAnchorsPEM=$LINKERD2_GLOBAL_IDENTITYTRUSTANCHORSPEM" \
--set "linkerd2.identity.issuer.crtExpiry=$LINKERD2_IDENTITY_ISSUER_CRTEXPIRY" \
--set "linkerd2.identity.issuer.tls.crtPEM=$LINKERD2_IDENTITY_ISSUER_TLS_CRTPEM" \
--set "linkerd2.identity.issuer.tls.keyPEM=$LINKERD2_IDENTITY_ISSUER_TLS_KEYPEM" \
--set "users={$USERS}" \
> $REDIRECT
else
echo "Upgrading VAB chart: $FLAG"
helm upgrade "$release_name" vab $FLAG \
--set "linkerd2.global.identityTrustAnchorsPEM=$LINKERD2_GLOBAL_IDENTITYTRUSTANCHORSPEM" \
--set "linkerd2.identity.issuer.crtExpiry=$LINKERD2_IDENTITY_ISSUER_CRTEXPIRY" \
--set "linkerd2.identity.issuer.tls.crtPEM=$LINKERD2_IDENTITY_ISSUER_TLS_CRTPEM" \
--set "linkerd2.identity.issuer.tls.keyPEM=$LINKERD2_IDENTITY_ISSUER_TLS_KEYPEM" \
--set "users={$USERS}" \
> $REDIRECT
fi
env:
LINKERD2_GLOBAL_IDENTITYTRUSTANCHORSPEM: ${{ secrets.LINKERD2_GLOBAL_IDENTITYTRUSTANCHORSPEM }}
LINKERD2_IDENTITY_ISSUER_CRTEXPIRY: ${{ secrets.LINKERD2_IDENTITY_ISSUER_CRTEXPIRY }}
LINKERD2_IDENTITY_ISSUER_TLS_CRTPEM: ${{ secrets.LINKERD2_IDENTITY_ISSUER_TLS_CRTPEM }}
LINKERD2_IDENTITY_ISSUER_TLS_KEYPEM: ${{ secrets.LINKERD2_IDENTITY_ISSUER_TLS_KEYPEM }}
USERS: ${{ secrets.USERS }}
GIT_COMMIT_ID: ${{ github.sha }}
DRY_RUN: ${{ github.ref != 'refs/heads/master' || github.event_name != 'push' }}

81 changes: 0 additions & 81 deletions .github/workflows/helm.yml

This file was deleted.

3 changes: 2 additions & 1 deletion helm/local/ledger/templates/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ spec:
containers:
- image: yoink00/ledger:{{ default "latest" .Values.image.tag }}
name: ledger
resources: {{ .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 10 }}

1 change: 1 addition & 0 deletions helm/vab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
charts/