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

Initial helm deploy #3

Merged
merged 71 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b5f2683
update readme
tcskill Apr 6, 2022
5abc7db
adds manage operator
tcskill Apr 7, 2022
2bb1804
removes namespace from tst case
tcskill Apr 7, 2022
b3797ae
remove namespace var from test
tcskill Apr 7, 2022
7cf6cba
fixes manage references
tcskill Apr 7, 2022
bd69337
servername update
tcskill Apr 7, 2022
dd81115
removes template script
tcskill Apr 7, 2022
445510c
removes template yaml
tcskill Apr 7, 2022
6dd8e16
updates name in deploy check
tcskill Apr 8, 2022
0847d27
op update
tcskill Apr 22, 2022
e57331f
updates app def
tcskill Apr 23, 2022
e689f27
adds subscription
tcskill Apr 24, 2022
4e24b3d
add required provider
tcskill Apr 24, 2022
482d307
adds catalog vars
tcskill Apr 24, 2022
e221c2e
remove bin
tcskill Apr 24, 2022
9f7ac72
rm bin
tcskill Apr 25, 2022
efd5d1a
rm bindir
tcskill Apr 25, 2022
5f77c55
updates stage0 test
tcskill Apr 25, 2022
5749115
adds provider for test cases
tcskill Apr 25, 2022
44b9f17
add script dir
tcskill Apr 25, 2022
3eae1ec
fixes typo in app name template
tcskill Apr 25, 2022
06dec59
fixes name
tcskill Apr 25, 2022
b8fff47
adds new instance charts
tcskill Apr 26, 2022
dc3aecb
fixes inst module name
tcskill Apr 26, 2022
d0fd7b1
fixes yaml format
tcskill Apr 26, 2022
862f82d
touch
tcskill Apr 26, 2022
a6d805d
rm secret for testing
tcskill Apr 26, 2022
54835f4
rm pull secret for test
tcskill Apr 26, 2022
d78527f
rm catalogs deployment
tcskill Apr 26, 2022
c695871
re adds catalog sync
tcskill Apr 26, 2022
5c9c3f8
move to one chart for app
tcskill Apr 27, 2022
db2883a
fixes typo
tcskill Apr 27, 2022
9b8e0e5
fixes yaml typo
tcskill Apr 27, 2022
f881a09
fix dir path
tcskill Apr 27, 2022
000b203
clnup
tcskill Apr 27, 2022
207fd16
creates jdbc secret
tcskill May 2, 2022
520b07a
uses db creds in repo
tcskill May 2, 2022
17a05c9
adds u/p for test case
tcskill May 2, 2022
743bfde
adds custom verify workflow
tcskill May 2, 2022
6aa719b
update tfvars
tcskill May 2, 2022
5a99fef
adds secrets to workflow
tcskill May 2, 2022
c72a12e
fixes secret name
tcskill May 2, 2022
d566bf0
adds string definition
tcskill May 2, 2022
fb5552b
updates local verify
tcskill May 2, 2022
8148f2e
updates workflow
tcskill May 3, 2022
064b38e
adds local workflow
tcskill May 3, 2022
afc6a5e
adds jdbc
tcskill May 6, 2022
1300810
adds db config
tcskill May 10, 2022
5c75d77
adds db vars
tcskill May 10, 2022
1c119e4
fixes db vars
tcskill May 10, 2022
6947777
fixes dependency
tcskill May 10, 2022
8069514
adds values
tcskill May 11, 2022
6222c02
cleanup
tcskill May 11, 2022
05a7f07
removes db cert and fixes dependency
tcskill May 11, 2022
e122ed1
cleans values
tcskill May 12, 2022
c92e6d5
add workspace deploy
tcskill May 13, 2022
124eea2
fix var definition
tcskill May 13, 2022
2abcfd5
fixes deploy test
tcskill May 13, 2022
a511a97
fixes workspace template
tcskill May 13, 2022
e6a2bf3
adds ws encrypt vars
tcskill May 15, 2022
698ed94
up wait if succeed
tcskill May 15, 2022
ba66131
change db reuse
tcskill May 16, 2022
9d9b8e8
updates wave
tcskill May 16, 2022
2f3ceb9
sync
tcskill May 16, 2022
7231496
up deploy ws wait for db configure
tcskill May 16, 2022
bca40cd
fix typo in deploy test
tcskill May 16, 2022
8e6ed57
adds crypto key vars
tcskill May 17, 2022
a7b06a7
adds crypto key support
tcskill May 17, 2022
072e902
updates template
tcskill May 18, 2022
ac49ff8
updates key and test
tcskill May 18, 2022
cb74d91
secret update
tcskill May 18, 2022
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
Binary file added .DS_Store
Binary file not shown.
76 changes: 63 additions & 13 deletions .github/scripts/validate-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GIT_REPO=$(cat git_repo)
GIT_TOKEN=$(cat git_token)

BIN_DIR=$(cat .bin_dir)
#BIN_DIR=$(cat .bin_dir)

export PATH="${BIN_DIR}:${PATH}"

Expand All @@ -25,6 +25,11 @@ SERVER_NAME=$(jq -r '.server_name // "default"' gitops-output.json)
LAYER=$(jq -r '.layer_dir // "2-services"' gitops-output.json)
TYPE=$(jq -r '.type // "base"' gitops-output.json)

APPNAME=$(jq -r '.appname // "manage"' gitops-output.json)
WSNAME=$(jq -r '.ws_name // "demo"' gitops-output.json)
INSTNAME=$(jq -r '.inst_name // "masdemo"' gitops-output.json)


mkdir -p .testrepo

git clone https://${GIT_TOKEN}@${GIT_REPO} .testrepo
Expand All @@ -41,11 +46,6 @@ fi
echo "Printing argocd/${LAYER}/cluster/${SERVER_NAME}/${TYPE}/${NAMESPACE}-${COMPONENT_NAME}.yaml"
cat "argocd/${LAYER}/cluster/${SERVER_NAME}/${TYPE}/${NAMESPACE}-${COMPONENT_NAME}.yaml"

if [[ ! -f "payload/${LAYER}/namespace/${NAMESPACE}/${COMPONENT_NAME}/values.yaml" ]]; then
echo "Application values not found - payload/${LAYER}/namespace/${NAMESPACE}/${COMPONENT_NAME}/values.yaml"
exit 1
fi

echo "Printing payload/${LAYER}/namespace/${NAMESPACE}/${COMPONENT_NAME}/values.yaml"
cat "payload/${LAYER}/namespace/${NAMESPACE}/${COMPONENT_NAME}/values.yaml"

Expand All @@ -64,21 +64,71 @@ else
sleep 30
fi

DEPLOYMENT="${COMPONENT_NAME}-${BRANCH}"
count=0
until kubectl get deployment "${DEPLOYMENT}" -n "${NAMESPACE}" || [[ $count -eq 20 ]]; do
echo "Waiting for deployment/${DEPLOYMENT} in ${NAMESPACE}"
until kubectl get deployment ibm-mas-manage-operator -n ${NAMESPACE} || [[ $count -eq 30 ]]; do
echo "Waiting for deployment/ibm-mas-manage-operator in ${NAMESPACE}"
count=$((count + 1))
sleep 15
sleep 60
done

if [[ $count -eq 20 ]]; then
echo "Timed out waiting for deployment/${DEPLOYMENT} in ${NAMESPACE}"
if [[ $count -eq 30 ]]; then
echo "Timed out waiting for deployment/ibm-mas-manage-operator in ${NAMESPACE}"
kubectl get all -n "${NAMESPACE}"
exit 1
fi

## workspace rollout
count=0
until kubectl get deployment ${INSTNAME}-entitymgr-ws -n ${NAMESPACE} || [[ $count -eq 50 ]]; do
echo "Waiting for deployment/${INSTNAME}-entitymgr-ws in ${NAMESPACE}"
count=$((count + 1))
sleep 60
done

if [[ $count -eq 50 ]]; then
echo "Timed out waiting for deployment/${APPNAME}-entitymgr-ws in ${NAMESPACE}"
kubectl get all -n "${NAMESPACE}"
exit 1
fi

kubectl get deployments -n ${NAMESPACE}

## maxinst deployment must succeed or nothing will work - this can take up to 4.5hrs if demo data is deployed too
count=0
until kubectl get deployment ${WSNAME}-manage-maxinst -n ${NAMESPACE} || [[ $count -eq 200 ]]; do
echo "Waiting for deployment/${WSNAME}-manage-maxinst in ${NAMESPACE}"
count=$((count + 1))
sleep 1m
done

if [[ $count -eq 200 ]]; then
echo "Timed out waiting for deployment/${WSNAME}-manage-maxinst in ${NAMESPACE}"
kubectl get all -n "${NAMESPACE}"
exit 1
fi

kubectl rollout status "deployment/${DEPLOYMENT}" -n "${NAMESPACE}" || exit 1

kubectl get deployments -n ${NAMESPACE}

## last test for all deploy
count=0
until kubectl get deployment ${WSNAME}-all -n ${NAMESPACE} || [[ $count -eq 200 ]]; do
echo "Waiting for deployment/${WSNAME}-all in ${NAMESPACE}"
count=$((count + 1))
sleep 1m
done

if [[ $count -eq 200 ]]; then
echo "Timed out waiting for deployment/${WSNAME}-all in ${NAMESPACE}"
kubectl get all -n "${NAMESPACE}"
exit 1
fi


kubectl get deployments -n ${NAMESPACE}




cd ..
rm -rf .testrepo
11 changes: 9 additions & 2 deletions .github/workflows/verify-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ on:
jobs:
verify:
if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }}
uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-gitops-module.yaml@v1
#uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-gitops-module.yaml@v1
uses: ./.github/workflows/verify-workflow.yaml
with:
testcase: ocp4_latest_gitops
testcase: ocp4_latest_gitops_maximo
secrets:
GIT_ORG: ${{ secrets.GIT_ORG }}
AWS_CLUSTER_USERNAME: ${{ secrets.AWS_CLUSTER_USERNAME }}
Expand All @@ -21,6 +22,12 @@ jobs:
GIT_ADMIN_USERNAME: ${{ secrets.GIT_ADMIN_USERNAME }}
GIT_ADMIN_TOKEN: ${{ secrets.GIT_ADMIN_TOKEN }}
CP_ENTITLEMENT_KEY: ${{ secrets.CP_ENTITLEMENT_KEY }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_CERT: ${{ secrets.DATABASE_CERT }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
CRYPTO_KEY: ${{ secrets.CRYPTO_KEY }}
CRYPTOX_KEY: ${{ secrets.CRYPTOX_KEY }}

verifyMetadata:
uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-module-metadata.yaml@v1
137 changes: 137 additions & 0 deletions .github/workflows/verify-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Verify

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
workflow_call:
inputs:
testcase:
required: true
type: string
default: ocp4_latest_gitops_maximo
skipDestroy:
required: false
type: string
default: "false"
secrets:
GIT_ORG:
required: false
AWS_CLUSTER_USERNAME:
required: true
AWS_CLUSTER_PASSWORD:
required: true
IBMCLOUD_API_KEY:
required: true
GIT_ADMIN_USERNAME:
required: true
GIT_ADMIN_TOKEN:
required: true
CP_ENTITLEMENT_KEY:
required: true
DATABASE_USERNAME:
required: true
DATABASE_PASSWORD:
required: true
DATABASE_CERT:
required: true
DATABASE_URL:
required: true
CRYPTO_KEY:
required: true
CRYPTOX_KEY:
required: true


# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
verify:
runs-on: ubuntu-latest
container: quay.io/cloudnativetoolkit/cli-tools:v1.1

strategy:
matrix:
testcase:
#comment-out or remove either of the platforms you do not need. ocp4_latest is IBM Cloud
- ${{ inputs.testcase }}
# - aws_latest_gitops
max-parallel: 1
fail-fast: false

env:
HOME: /home/devops

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v1

- id: variables
name: Set up variables
env:
GIT_ORG: ${{ secrets.GIT_ORG }}
AWS_CLUSTER_USERNAME: ${{ secrets.AWS_CLUSTER_USERNAME }}
AWS_CLUSTER_PASSWORD: ${{ secrets.AWS_CLUSTER_PASSWORD }}
IBM_CLUSTER_USERNAME: "apikey"
IBM_CLUSTER_PASSWORD: ${{ secrets.IBMCLOUD_API_KEY }}
ENVIRONMENT: ${{ matrix.testcase }}
shell: bash
run: |
repo=$(echo ${GITHUB_REPOSITORY} | sed -E "s~.*/[^-]+-(.*)~\1-${{matrix.testcase}}~g" | sed 's/_latest_gitops//g')
echo "Repo: $repo"
echo "::set-output name=repo::$repo"

org="${GIT_ORG:-cloud-native-toolkit-test}"
echo "Org: $org"
echo "::set-output name=org::$org"

if [[ $ENVIRONMENT =~ ^aws ]]; then
echo "::set-output name=CLUSTER_USERNAME::$AWS_CLUSTER_USERNAME"
echo "::set-output name=CLUSTER_PASSWORD::$AWS_CLUSTER_PASSWORD"
else
echo "::set-output name=CLUSTER_USERNAME::$IBM_CLUSTER_USERNAME"
echo "::set-output name=CLUSTER_PASSWORD::$IBM_CLUSTER_PASSWORD"
fi

- name: Verify deploy on ${{ matrix.testcase }}
uses: cloud-native-toolkit/action-module-verify-deploy@main
with:
clusterId: ${{ matrix.testcase }}
validateDeployScript: .github/scripts/validate-deploy.sh
env:
TF_VAR_git_username: ${{ secrets.GIT_ADMIN_USERNAME }}
TF_VAR_git_token: ${{ secrets.GIT_ADMIN_TOKEN }}
TF_VAR_git_org: ${{ steps.variables.outputs.org }}
TF_VAR_git_repo: ${{ steps.variables.outputs.repo }}
TF_VAR_bootstrap_prefix: ${{ steps.variables.outputs.repo }}
TF_VAR_cp_entitlement_key: ${{ secrets.CP_ENTITLEMENT_KEY }}
TF_VAR_cluster_username: ${{ steps.variables.outputs.CLUSTER_USERNAME }}
TF_VAR_cluster_password: ${{ steps.variables.outputs.CLUSTER_PASSWORD }}
TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }}
TF_VAR_database_username: ${{ secrets.DATABASE_USERNAME }}
TF_VAR_database_password: ${{ secrets.DATABASE_PASSWORD }}
TF_VAR_database_cert: ${{ secrets.DATABASE_CERT }}
TF_VAR_database_url: ${{ secrets.DATABASE_URL }}
TF_VAR_database_crypto_key: ${{ secrets.CRYPTO_KEY }}
TF_VAR_database_cryptox_key: ${{ secrets.CRYPTOX_KEY }}

- name: Verify destroy on ${{ matrix.testcase }}
uses: cloud-native-toolkit/action-module-verify-destroy@main
if: ${{ always() && inputs.skipDestroy != 'true' }}
with:
clusterId: ${{ matrix.testcase }}
env:
TF_VAR_git_username: ${{ secrets.GIT_ADMIN_USERNAME }}
TF_VAR_git_token: ${{ secrets.GIT_ADMIN_TOKEN }}
TF_VAR_git_org: ${{ steps.variables.outputs.org }}
TF_VAR_git_repo: ${{ steps.variables.outputs.repo }}
TF_VAR_bootstrap_prefix: ${{ steps.variables.outputs.repo }}
TF_VAR_cp_entitlement_key: ${{ secrets.CP_ENTITLEMENT_KEY }}
TF_VAR_cluster_username: ${{ steps.variables.outputs.CLUSTER_USERNAME }}
TF_VAR_cluster_password: ${{ steps.variables.outputs.CLUSTER_PASSWORD }}
TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }}
TF_VAR_database_username: ${{ secrets.DATABASE_USERNAME }}
TF_VAR_database_password: ${{ secrets.DATABASE_PASSWORD }}
TF_VAR_database_cert: ${{ secrets.DATABASE_CERT }}
TF_VAR_database_url: ${{ secrets.DATABASE_URL }}
TF_VAR_database_crypto_key: ${{ secrets.CRYPTO_KEY }}
TF_VAR_database_cryptox_key: ${{ secrets.CRYPTOX_KEY }}
14 changes: 11 additions & 3 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ on:
jobs:
verify:
if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }}
uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-gitops-module.yaml@v1
#uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-gitops-module.yaml@v1
uses: ./.github/workflows/verify-workflow.yaml
with:
testcase: ocp4_latest_gitops
testcase: ocp4_latest_gitops_maximo
secrets:
GIT_ORG: ${{ secrets.GIT_ORG }}
AWS_CLUSTER_USERNAME: ${{ secrets.AWS_CLUSTER_USERNAME }}
Expand All @@ -21,6 +22,12 @@ jobs:
GIT_ADMIN_USERNAME: ${{ secrets.GIT_ADMIN_USERNAME }}
GIT_ADMIN_TOKEN: ${{ secrets.GIT_ADMIN_TOKEN }}
CP_ENTITLEMENT_KEY: ${{ secrets.CP_ENTITLEMENT_KEY }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_CERT: ${{ secrets.DATABASE_CERT }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
CRYPTO_KEY: ${{ secrets.CRYPTO_KEY }}
CRYPTOX_KEY: ${{ secrets.CRYPTOX_KEY }}

verifyMetadata:
uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-module-metadata.yaml@v1
Expand All @@ -29,4 +36,5 @@ jobs:
needs: [verify, verifyMetadata]
uses: cloud-native-toolkit/action-workflows/.github/workflows/release-module.yaml@v1
secrets:
TOKEN: ${{ secrets.TOKEN }}
TOKEN: ${{ secrets.TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
terraform.tfstate
terraform.tfstate.backup
.terraform/
.vscode
Loading