forked from Sunbird-Lern/sunbird-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue Sunbird-Lern#24 chore:Sunbird auth package build
- Loading branch information
Showing
10 changed files
with
1,294 additions
and
0 deletions.
There are no files selected for viewing
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,44 @@ | ||
- name: Create sunbird auth directory | ||
file: | ||
path: sunbird_auth_{{sunbird_auth_version}} | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: get the keycloak tarball | ||
get_url: url={{keycloak_pkg_src}} dest=sunbird_auth_{{sunbird_auth_version}} force=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: get the postgresql driver | ||
get_url: url={{postgresql_driver_src}} dest=sunbird_auth_{{sunbird_auth_version}}/modules/system/layers/keycloak/org/postgresql/main force=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: Clone sunbird auth repo | ||
git: | ||
repo: https://github.com/project-sunbird/sunbird-auth.git | ||
dest: sunbird-auth | ||
refspec: refs/heads/master | ||
|
||
- name: Build provider package | ||
shell: cd sunbird-auth/keycloak/sms-provider && mvn package | ||
|
||
- name: Copy SMS OTP jar file to providers dir | ||
copy: src=sunbird-auth/keycloak/sms-provider/target/keycloak-email-phone-autthenticator-1.0-SNAPSHOT.jar dest="sunbird_auth_{{sunbird_auth_version}}/providers" | ||
|
||
- name: Copy Custom Validation theme html to sunbird login theme | ||
copy: src=sunbird-auth/keycloak/sms-provider/templates dest=sunbird_auth_{{sunbird_auth_version}}/themes/sunbird/login | ||
|
||
- name: Copy configuration templates to Keycloak | ||
copy: src=sunbird-auth/keycloak/scripts/ansible/roles/keycloak/templates/ dest="sunbird_auth_{{sunbird_auth_version}}/standalone/configuration/standalone-ha.xml" | ||
|
||
- name: XML file | ||
template: | ||
src: sunbird-auth/keycloak/scripts/ansible/roles/keycloak/templates/standalone-ha.xml | ||
dest: "sunbird_auth_{{sunbird_auth_version}}/standalone/configuration/standalone-ha.xml" | ||
|
||
- name: Copy module.xml | ||
template: | ||
src: sunbird-auth/keycloak/scripts/ansible/roles/keycloak/templates/module.xml.j2 | ||
dest: "sunbird_auth_{{sunbird_auth_version}}/modules/system/layers/keycloak/org/postgresql/main/module.xml" | ||
|
||
- name: Create SMS provider configuration file | ||
template: | ||
src: "sunbird-auth/keycloak/scripts/ansible/roles/keycloak/Msg91Creds.json.j2" | ||
dest: "sunbird_auth_{{sunbird_auth_version}}/bin/sms-provider/Msg91Creds.json" |
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,4 @@ | ||
- include: build.yml | ||
tags: | ||
- build | ||
|
7 changes: 7 additions & 0 deletions
7
keycloak/scripts/ansible/roles/keycloak/templates/Msg91Creds.json.j2
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,7 @@ | ||
{ | ||
"auth_key": "{{vault_auth_key}}", | ||
"sender": "{{vault_sender}}", | ||
"country": "{{vault_country}}", | ||
"route": "{{vault_route}}", | ||
"sms_method_type": "{{vault_sms_method_type}}" | ||
} |
10 changes: 10 additions & 0 deletions
10
keycloak/scripts/ansible/roles/keycloak/templates/module.xml.j2
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module xmlns="urn:jboss:module:1.1" name="org.postgresql"> | ||
<resources> | ||
<resource-root path="postgresql-9.4.1212.jar"/> | ||
</resources> | ||
<dependencies> | ||
<module name="javax.api"/> | ||
<module name="javax.transaction.api"/> | ||
</dependencies> | ||
</module> |
571 changes: 571 additions & 0 deletions
571
keycloak/scripts/ansible/roles/keycloak/templates/standalone-ha.xml
Large diffs are not rendered by default.
Oops, something went wrong.
556 changes: 556 additions & 0 deletions
556
keycloak/scripts/ansible/roles/keycloak/templates/standalone-ha.xml-old
Large diffs are not rendered by default.
Oops, something went wrong.
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,4 @@ | ||
--- | ||
sunbird_auth_version: 1.0v | ||
keycloak_pkg_src: https://downloads.jboss.org/keycloak/3.2.0.Final/keycloak-3.2.0.Final.tar.gz | ||
postgresql_driver_src: https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar |
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,70 @@ | ||
#!groovy | ||
|
||
node('build-slave') { | ||
|
||
currentBuild.result = "SUCCESS" | ||
|
||
try { | ||
|
||
stage('Cleanup'){ | ||
sh('rm -rf sunbird-auth') | ||
sh('rm -rf project-sunbird-devops') | ||
sh('rm -rf keycloak-3.2.0.Final.tar.gz') | ||
sh('rm -rf keycloak_build/login.tar.gz') | ||
sh('rm -rf ansible/artifacts/sunbird/login.tar.gz') | ||
sh('rm -rf keycloak_build') | ||
} | ||
|
||
stage('Checkout'){ | ||
checkout scm | ||
sh('git clone https://github.com/project-sunbird/sunbird-auth.git') | ||
|
||
// @Todo Update the URL | ||
// sh('git clone https://github.com/ahghatol/sunbird-devops-1.git project-sunbird-devops') | ||
|
||
sh('git clone https://github.com/project-sunbird/sunbird-devops project-sunbird-devops') | ||
|
||
// Download keycloak package and driver | ||
sh('wget https://downloads.jboss.org/keycloak/3.2.0.Final/keycloak-3.2.0.Final.tar.gz') | ||
sh('wget https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar') | ||
} | ||
|
||
stage('Build'){ | ||
sh('mkdir -p sunbird-auth-0.1v'); | ||
|
||
// Login theme build | ||
sh('cd ansible/artifacts/sunbird && tar -zcvf login.tar.gz *') | ||
|
||
// Sms plugin build | ||
sh('cd sunbird-auth/keycloak/sms-provider && mvn package') | ||
|
||
|
||
sh('cp keycloak-3.2.0.Final.tar.gz keycloak_build') | ||
sh('cp postgresql-9.4.1212.jar keycloak_build') | ||
|
||
// Copy file to keycloak_build directory | ||
sh('cp sunbird-auth/keycloak/sms-provider/target/keycloak-email-phone-autthenticator-1.0-SNAPSHOT.jar keycloak_build') | ||
|
||
// Create zip and Copy file to keycloak_build directory | ||
sh('cd sunbird-auth/keycloak/sms-provider/templates && tar -zcvf templates.tar.gz *') | ||
sh('cp sunbird-auth/keycloak/sms-provider/templates/templates.tar.gz keycloak_build') | ||
|
||
// Copy ansible template for Provider config and keycloak configuration | ||
sh('mkdir -p keycloak_build/ansible-templates'); | ||
|
||
sh('cp project-sunbird-devops/ansible/roles/keycloak/templates/* keycloak_build/ansible-templates') | ||
|
||
sh('cp ansible/artifacts/sunbird/login.tar.gz keycloak_build') | ||
sh('tar -zcvf keycloak_build.tar.gz keycloak_build') | ||
} | ||
|
||
stage('Archive'){ | ||
archiveArtifacts 'keycloak_build/login.tar.gz' | ||
archiveArtifacts 'keycloak_build.tar.gz' | ||
} | ||
} | ||
catch (err) { | ||
currentBuild.result = "FAILURE" | ||
throw err | ||
} | ||
} |
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,27 @@ | ||
#!/bin/sh | ||
# Build script | ||
# set -o errexit | ||
|
||
#!/bin/sh | ||
# Build script | ||
# set -o errexit | ||
set -e | ||
e () { | ||
echo $( echo ${1} | jq ".${2}" | sed 's/\"//g') | ||
} | ||
m=$(cat $METADATA_FILE) | ||
|
||
org=$(e "${m}" "org") | ||
name=$(e "${m}" "name") | ||
version=$(e "${m}" "version") | ||
|
||
artifactLabel=${ARTIFACT_LABEL:-bronze} | ||
env=${ENV:-null} | ||
|
||
echo "artifactLabel: ${artifactLabel}" | ||
echo "env: ${env}" | ||
echo "org: ${org}" | ||
echo "name: ${name}" | ||
echo "version: ${version}" | ||
echo "ANSIBLE_PATH: $ANSIBLE_PATH" | ||
|
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 @@ | ||
apk -v add ansible=2.3.0.0-r1 |