Skip to content

Commit

Permalink
chore: Jenkins X build pack
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuasimon-taulia committed Oct 21, 2022
0 parents commit 4572c61
Show file tree
Hide file tree
Showing 23 changed files with 714 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Directory-based project format:
.idea/

## osx
**/.DS_Store
**/.DS_Store?
**/._*
**/.Spotlight-V100
**/.Trashes
**/ehthumbs.db
**/Thumbs.db

# helm
Chart.lock
**/charts/*.tgz
**/output/*
**/*requirements.lock
**/*Chart.lock
# Except this file
!.gitignore

# helmfile
# this cache directory causes issues using remote charts
.helmfile

# Python
**/*.pyc

# Test results
**/results.xml
7 changes: 7 additions & 0 deletions .jx/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: core.jenkins-x.io/v4beta1
kind: Settings
spec:
promoteEnvironments:
- key: dev
namespace: argocd
promotionStrategy: Auto
2 changes: 2 additions & 0 deletions .jx/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# this file is used to override the APP_NAME and REPO_NAME
export APP_NAME="${APP_NAME_OVERRIDE:-argo-cd-apps}"
35 changes: 35 additions & 0 deletions .lighthouse/jenkins-x/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
name: pullrequest
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/helm/pullrequest.yaml@versionStream
name: ""
resources:
# override limits for all containers here
limits: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
name: ""
resources: {}
- name: jx-variables
resources:
# override requests for the pod here
requests:
cpu: 400m
memory: 512Mi
- name: build-helm-build
resources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 12h0m0s
status: {}
41 changes: 41 additions & 0 deletions .lighthouse/jenkins-x/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
name: release
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/helm/release.yaml@versionStream
name: ""
resources:
# override limits for all containers here
limits: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone.yaml@versionStream
name: ""
resources: {}
- name: next-version
resources: {}
- name: jx-variables
resources:
# override requests for the pod here
requests:
cpu: 400m
memory: 512Mi
- name: promote-changelog
resources: {}
- name: promote-helm-release
resources: {}
- name: promote-jx-promote
resources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 12h0m0s
status: {}
16 changes: 16 additions & 0 deletions .lighthouse/jenkins-x/triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
kind: TriggerConfig
spec:
presubmits:
- name: pr
context: "pr"
always_run: true
optional: false
source: "pullrequest.yaml"
postsubmits:
- name: release
context: "release"
source: "release.yaml"
branches:
- ^main$
- ^master$
5 changes: 5 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
approvers:
- joshuasimon-taulia
options: {}
reviewers:
- joshuasimon-taulia
5 changes: 5 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
aliases:
best-approvers:
- joshuasimon-taulia
best-reviewers:
- joshuasimon-taulia
30 changes: 30 additions & 0 deletions charts/argo-cd-apps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Directory-based project format:
.idea/

## osx
**/.DS_Store
**/.DS_Store?
**/._*
**/.Spotlight-V100
**/.Trashes
**/ehthumbs.db
**/Thumbs.db

# helm
Chart.lock
**/charts/*.tgz
**/output/*
**/*requirements.lock
**/*Chart.lock
# Except this file
!.gitignore

# helmfile
# this cache directory causes issues using remote charts
.helmfile

# Python
**/*.pyc

# Test results
**/results.xml
24 changes: 24 additions & 0 deletions charts/argo-cd-apps/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: helm-argo-cd-apps
description: Creates a argo-cd-apps serving and eventing CR using the argo-cd-apps operator

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 # check latest git tag for source of truth

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
59 changes: 59 additions & 0 deletions charts/argo-cd-apps/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
CHART_REPO := http://jenkins-x-chartmuseum:8080
CURRENT=$(pwd)
NAME := argo-cd-apps
OS := $(shell uname)
RELEASE_VERSION := $(shell cat ../../VERSION)

build: clean
rm -rf requirements.lock
helm dependency build
helm lint

install: clean build
helm install . --name ${NAME}

upgrade: clean build
helm upgrade ${NAME} .

delete:
helm delete --purge ${NAME}

clean:
rm -rf charts
rm -rf ${NAME}*.tgz

release: clean
helm dependency build
helm lint
helm init --client-only
helm package .
curl --fail -u $(CHARTMUSEUM_CREDS_USR):$(CHARTMUSEUM_CREDS_PSW) --data-binary "@$(NAME)-$(shell sed -n 's/^version: //p' Chart.yaml).tgz" $(CHART_REPO)/api/charts
rm -rf ${NAME}*.tgz%

docs:
chart-doc-gen -d=doc.yaml -v values.yaml > README.md

preview-template:
jx ns jx
mkdir -p output
jx preview template \
--app "$(shell basename ${PWD})" \
-f ../../preview/helmfile.yaml > output/output.yaml
jx gitops split --dir output

tag:
ifeq ($(OS),Darwin)
sed -i "" -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
sed -i "" -e "s/tag:.*/tag: $(RELEASE_VERSION)/" values.yaml
else ifeq ($(OS),Linux)
sed -i -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/jxgh\/argo-cd-apps|" values.yaml
sed -i -e "s/tag:.*/tag: $(RELEASE_VERSION)/" values.yaml
else
echo "platfrom $(OS) not supported to release from"
exit -1
endif
git add --all
git commit -m "chore: release $(RELEASE_VERSION)" --allow-empty # if first release then no verion update is performed
git tag -fa v$(RELEASE_VERSION) -m "Release version $(RELEASE_VERSION)"
git push origin v$(RELEASE_VERSION)
76 changes: 76 additions & 0 deletions charts/argo-cd-apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# argo-cd-apps

[argo-cd-apps](https://github.com/argoproj) - using argo-cd

## TL;DR;

```bash
$ helm repo add joshuasimon https://jenkins-x-charts.github.io/repo
$ helm repo update
$ helm search repo joshuasimon/helm-argo-cd-apps --version=0.1.0
$ helm upgrade -i argo-cd-apps joshuasimon/helm-argo-cd-apps -n argocd --create-namespace --version=0.1.0
```

## Introduction

This chart deploys argo-cd-apps k8s custom resources on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes v1.21+
- install the [argo-cd](https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd) chart

## Installing the Chart

To install/upgrade the chart with the release name `argo-cd-apps`:

```bash
$ helm upgrade -i argo-cd-apps joshuasimon/helm-argo-cd-apps -n argocd --create-namespace --version=0.1.0
```

The command deploys argo-cd-apps k8s custom resources on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall the `argo-cd-apps`:

```bash
$ helm uninstall argo-cd-apps -n argocd
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configurable parameters of the `helm-argo-cd-apps` chart and their default values.

| Parameter | Description | Default |
|-------------------------------------------|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| extraConfig | additional applicationset configuration | <code>{}</code> |
| syncPolicy | [argo-cd application sync policy](https://argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/) | <code>{"automated":{"prune":true,"selfHeal":true},"syncOptions":["CreateNamespace=true"]}</code> |
| jxRequirements.ingress.annotations | shared ingress annotations on all services | <code>{}</code> |
| jxRequirements.ingress.apiVersion | | <code>"networking.k8s.io/v1"</code> |
| jxRequirements.ingress.domain | the domain for hosts | <code>""</code> |
| jxRequirements.ingress.externalDNS | | <code>false</code> |
| jxRequirements.ingress.namespaceSubDomain | | <code>-jx.</code> |
| jxRequirements.ingress.serviceType | | <code>""</code> |
| jxRequirements.ingress.tls.email | | <code>""</code> |
| jxRequirements.ingress.tls.enabled | | <code>false</code> |
| jxRequirements.ingress.tls.production | | <code>false</code> |
| jxRequirements.ingress.tls.secretName | | <code>""</code> |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:

```bash
$ helm upgrade -i argo-cd-apps joshuasimon/helm-argo-cd-apps -n argocd --create-namespace --version=0.1.0 --set syncPolicy={"automated":{"prune":true,"selfHeal":true},"syncOptions":["CreateNamespace=true"]}
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while
installing the chart. For example:

```bash
$ helm upgrade -i argo-cd-apps joshuasimon/helm-argo-cd-apps -n argocd --create-namespace --version=0.1.0 --values values.yaml
```
20 changes: 20 additions & 0 deletions charts/argo-cd-apps/doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
project:
name: argo-cd-apps
shortName: argo-cd-apps
url: https://github.com/argoproj
description: using argo-cd
app: argo-cd-apps k8s custom resources
repository:
url: https://jenkins-x-charts.github.io/repo
name: joshuasimon
chart:
name: argo-cd-apps
version: v0.1.0
values: "-- generate from values file --"
valuesExample: "-- generate from values file --"
prerequisites:
- "Kubernetes v1.21+"
- "install the [argo-cd](https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd) chart"
release:
name: argo-cd-apps
namespace: argocd
2 changes: 2 additions & 0 deletions charts/argo-cd-apps/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1. Get the argo-cd-apps service URL by running these commands:
k get svc -l app=argo-cd-apps
Loading

0 comments on commit 4572c61

Please sign in to comment.