-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 8c96cda
Showing
12 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
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,56 @@ | ||
name: "Validate PR title" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# Please look up the latest version from | ||
# https://github.com/amannn/action-semantic-pull-request/releases | ||
# from https://github.com/amannn/action-semantic-pull-request/commits/main | ||
- uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# Configure which types are allowed. | ||
# Default: https://github.com/commitizen/conventional-commit-types | ||
types: | | ||
fix | ||
feat | ||
docs | ||
chore | ||
breaking | ||
# Configure that a scope must always be provided. | ||
requireScope: false | ||
# Configure additional validation for the subject based on a regex. | ||
# This example ensures the subject starts with an uppercase character. | ||
subjectPattern: ^[A-Z].+$ | ||
# If `subjectPattern` is configured, you can use this property to override | ||
# the default error message that is shown when the pattern doesn't match. | ||
# The variables `subject` and `title` can be used within the message. | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
starts with an uppercase character. | ||
# For work-in-progress PRs you can typically use draft pull requests | ||
# from Github. However, private repositories on the free plan don't have | ||
# this option and therefore this action allows you to opt-in to using the | ||
# special "[WIP]" prefix to indicate this state. This will avoid the | ||
# validation of the PR title and the pull request checks remain pending. | ||
# Note that a second check will be reported if this is enabled. | ||
wip: true | ||
# When using "Squash and merge" on a PR with only one commit, GitHub | ||
# will suggest using that commit message instead of the PR title for the | ||
# merge commit, and it's easy to commit this by mistake. Enable this option | ||
# to also validate the commit message for one commit PRs. | ||
validateSingleCommit: false | ||
# Related to `validateSingleCommit` you can opt-in to validate that the PR | ||
# title matches a single commit to avoid confusion. | ||
validateSingleCommitMatchesPrTitle: false |
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,23 @@ | ||
name: Release | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "CODEOWNERS" | ||
- "**.md" | ||
- ".**" | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Release action | ||
id: release | ||
uses: pagopa/eng-github-actions-iac-template/global/release-action@main # | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
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,9 @@ | ||
**/charts | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ |
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,25 @@ | ||
repos: | ||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.35.1 | ||
hooks: | ||
- id: yamllint | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
# Common errors | ||
- id: end-of-file-fixer | ||
exclude_types: [sql] | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
exclude_types: [sql] | ||
- id: check-yaml | ||
- id: check-executables-have-shebangs | ||
# Cross platform | ||
- id: check-case-conflict | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
exclude_types: [sql] | ||
# Security | ||
- id: detect-aws-credentials | ||
args: ['--allow-missing-credentials'] | ||
- id: detect-private-key |
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,14 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "angular", | ||
"releaseRules": [{ "type": "breaking", "release": "major" }] | ||
} | ||
], | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
] | ||
} | ||
|
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 @@ | ||
rules: | ||
anchors: enable | ||
braces: enable | ||
brackets: enable | ||
colons: enable | ||
commas: enable | ||
comments: disable | ||
comments-indentation: disable | ||
document-end: disable | ||
document-start: disable | ||
empty-lines: enable | ||
empty-values: disable | ||
float-values: disable | ||
hyphens: enable | ||
indentation: | ||
ignore: | | ||
**/Chart.yaml | ||
key-duplicates: enable | ||
key-ordering: disable | ||
line-length: disable | ||
new-line-at-end-of-file: enable | ||
new-lines: enable | ||
octal-values: disable | ||
quoted-strings: disable | ||
trailing-spaces: enable | ||
truthy: disable |
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 @@ | ||
# devopslab-diego-deploy |
Empty file.
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,3 @@ | ||
#!/bin/bash | ||
|
||
../../../scripts/deploy.sh values.yaml diego dvopla-d-itn-dev-aks one-color |
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,63 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit the script if any command fails | ||
|
||
### How to use | ||
# | ||
# deploy.sh <values yaml file> <namespace > <cluster k8s name> <app name or release name> | ||
# deploy.sh values.yaml mil cstar-d-weu-dev01-aks status | ||
# | ||
# | ||
|
||
# Function to handle errors | ||
handle_error() { | ||
echo "❌ Error: $1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Parameter verification | ||
VALUES_FILE_NAME=$1 | ||
NAMESPACE=$2 | ||
CLUSTER_NAME=$3 # New parameter for cluster name | ||
APP_NAME=$4 | ||
|
||
if [ -z "$VALUES_FILE_NAME" ] || [ -z "$NAMESPACE" ] || [ -z "$APP_NAME" ] || [ -z "$CLUSTER_NAME" ]; then | ||
handle_error "All parameters are required: VALUES_FILE_NAME NAMESPACE APP_NAME CLUSTER_NAME" | ||
fi | ||
|
||
# Check if kubectl is installed | ||
if ! command -v kubectl &> /dev/null; then | ||
handle_error "kubectl is not installed. Please install it and try again." | ||
fi | ||
|
||
# Check if helm is installed | ||
if ! command -v helm &> /dev/null; then | ||
handle_error "Helm is not installed. Please install it and try again." | ||
fi | ||
|
||
echo "🔄 Switching Kubernetes context to cluster $CLUSTER_NAME" | ||
if ! kubectl config use-context "$CLUSTER_NAME"; then | ||
handle_error "Unable to switch context to $CLUSTER_NAME. Make sure the cluster exists in your kubeconfig." | ||
fi | ||
|
||
echo "🪚 Deleting charts folder" | ||
rm -rf charts || handle_error "Unable to delete charts folder" | ||
|
||
echo "🔨 Starting Helm Template" | ||
helm dep build && helm template . -f "$VALUES_FILE_NAME" --debug | ||
|
||
|
||
echo "🚀 Launch helm deploy" | ||
# Execute helm upgrade/install command and capture output and exit code | ||
helm upgrade --namespace "$NAMESPACE" \ | ||
--install --values "$VALUES_FILE_NAME" \ | ||
--wait --timeout 3m0s "$APP_NAME" . | ||
|
||
exit_code=$? | ||
|
||
# Check the command result | ||
if [ $exit_code -ne 0 ]; then | ||
handle_error "Failed to upgrade/install Helm chart" | ||
else | ||
echo "✅ Release installation completed successfully" | ||
fi |