Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ad4fb5
[DSD-1102] placed keycloak init scripts
ckm007 Jun 8, 2022
70ae1be
[DSD-1102] updated the push triggers
ckm007 Jun 8, 2022
734bea8
Update push_trigger.yml
ckm007 Jun 8, 2022
1a2c745
[DSD-1102] Keycloak 18 onwards APIs have changed. '/auth' is removed …
Jun 8, 2022
06f0b9f
[DSD-1102] Recopied from develop branch.
Jun 8, 2022
b120282
Merge pull request #13 from pjoshi751/release-1.2.0.1
ckm007 Jun 8, 2022
162f009
[MOSIP-22429] reverting changes made as per 9.2.2 chart
ckm007 Jun 11, 2022
a25122e
updated keycloak-init to update frontend url
ckm007 Jul 5, 2022
0ab420c
[MOSIP-22792] added changes for fronend URL change
ckm007 Jul 6, 2022
ea321af
[MOSIP-22398] restructured keycloak customisation
ckm007 Jul 16, 2022
cf09a51
[MOSIP-22398] added jboss and artemis customisation
ckm007 Jul 16, 2022
fea18cb
[MOSIP-22398] updated push triger
ckm007 Jul 16, 2022
da52aa3
[ DSD-1246 ] added method to create mappers for keycloak client
Jul 18, 2022
6afd47d
[ DSD-1246 ] removed commented print statement
Jul 18, 2022
d2b4fa3
Merge pull request #17 from syedsalman3753/release-1.2.0.1
ckm007 Jul 18, 2022
169add3
[MOSIP-20028] added action for tagging
ckm007 Jul 19, 2022
94898ff
[ MOSIP-23097 ] added methods in keycloak_init.py to delete-realms, d…
Jul 22, 2022
64be31c
[ MOSIP-23097 ] Beautified
Jul 22, 2022
fb7b305
Merge pull request #19 from syedsalman3753/release-1.2.0.1
ckm007 Jul 27, 2022
fd5600e
[ MOSIP-23206 ] added method to assign client roles for service accou…
Aug 4, 2022
88ea2ff
Merge pull request #21 from syedsalman3753/release-1.2.0.1
ckm007 Aug 5, 2022
a4edb4c
Update push_trigger.yml
ckm007 Aug 23, 2022
043cbb0
Merge pull request #22 from mosip/ckm007-patch-1
ckm007 Aug 23, 2022
04a4399
[MOSIP-23664] Exit value bug fixed. Example input.yaml added.
Aug 24, 2022
e25a195
Merge pull request #23 from pjoshi751/release-1.2.0.1
ckm007 Aug 24, 2022
9d225a9
Update keycloak_init.py
Mahesh-Binayak Sep 21, 2022
fdf6d17
Merge pull request #29 from Mahesh-Binayak/release-1.2.0.1
ckm007 Sep 21, 2022
40187ff
Bump certifi from 2021.5.30 to 2022.12.7 in /keycloak-init
dependabot[bot] Dec 9, 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
806 changes: 18 additions & 788 deletions .github/workflows/push_trigger.yml

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tagging of repos

env:
tag: v1.2.3

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be published'
required: true
default: 'v1.2.3'
type: string
body:
description: 'Release body message'
required: true
default: 'Changes in this Release'
type: string
pre-release:
description: 'Pre-release? True/False'
required: true
default: False
type: string

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
body: |
${{ github.event.inputs.body }}
draft: false
prerelease: ${{fromJSON(github.event.inputs.pre-release)}}
45 changes: 45 additions & 0 deletions keycloak-artemis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM docker.io/bitnami/minideb:buster
LABEL maintainer "Bitnami <containers@bitnami.com>"

ENV HOME="/" \
OS_ARCH="amd64" \
OS_FLAVOUR="debian-10" \
OS_NAME="linux"

ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security"

COPY prebuildfs /
RUN chmod +x /usr/sbin/install_packages
# Install required system packages and dependencies
RUN install_packages acl ca-certificates curl gzip libaio1 libc6 procps rsync tar zlib1g
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "wait-for-port" "1.0.1-10" --checksum 35c818ba3f4b5aae905959bc7d3a5e81fc63786e3c662b604612c0aa7fcda8fd
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "java" "11.0.14-7" --checksum 900545c4f346a0ece8abf2caf64fd9d4ab7514967d4614d716bf7362b24f828b
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "keycloak" "16.1.1-8" --checksum c432a2b3551a40e48b77f63257def52e9556c2b6ffa989e7eb6847ad87fdd9db
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "gosu" "1.14.0-7" --checksum d6280b6f647a62bf6edc74dc8e526bfff63ddd8067dcb8540843f47203d9ccf1
RUN apt-get update && apt-get upgrade -y && \
rm -r /var/lib/apt/lists /var/cache/apt/archives
RUN chmod g+rwX /opt/bitnami

COPY ./theme/base /opt/bitnami/keycloak/themes/base

COPY ./theme/mosip /opt/bitnami/keycloak/themes/mosip

COPY ./standalone/deployments/* /opt/bitnami/keycloak/standalone/deployments

COPY rootfs /
RUN chmod +x /opt/bitnami/scripts/keycloak/postunpack.sh
RUN chmod +x /opt/bitnami/scripts/java/postunpack.sh

RUN /opt/bitnami/scripts/java/postunpack.sh
RUN /opt/bitnami/scripts/keycloak/postunpack.sh
ENV APP_VERSION="16.1.1" \
BITNAMI_APP_NAME="keycloak" \
JAVA_HOME="/opt/bitnami/java" \
PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/keycloak/bin:$PATH"

RUN chmod +x /opt/bitnami/scripts/keycloak/entrypoint.sh
RUN chmod +x /opt/bitnami/scripts/keycloak/setup.sh
RUN chmod +x /opt/bitnami/scripts/keycloak/run.sh
USER 1001
ENTRYPOINT [ "/opt/bitnami/scripts/keycloak/entrypoint.sh" ]
CMD [ "/opt/bitnami/scripts/keycloak/run.sh" ]
30 changes: 30 additions & 0 deletions keycloak-artemis/prebuildfs/opt/bitnami/.bitnami_components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"gosu": {
"arch": "amd64",
"digest": "d6280b6f647a62bf6edc74dc8e526bfff63ddd8067dcb8540843f47203d9ccf1",
"distro": "debian-10",
"type": "NAMI",
"version": "1.14.0-7"
},
"java": {
"arch": "amd64",
"digest": "900545c4f346a0ece8abf2caf64fd9d4ab7514967d4614d716bf7362b24f828b",
"distro": "debian-10",
"type": "NAMI",
"version": "11.0.14-7"
},
"keycloak": {
"arch": "amd64",
"digest": "c432a2b3551a40e48b77f63257def52e9556c2b6ffa989e7eb6847ad87fdd9db",
"distro": "debian-10",
"type": "NAMI",
"version": "16.1.1-8"
},
"wait-for-port": {
"arch": "amd64",
"digest": "35c818ba3f4b5aae905959bc7d3a5e81fc63786e3c662b604612c0aa7fcda8fd",
"distro": "debian-10",
"type": "NAMI",
"version": "1.0.1-10"
}
}
3 changes: 3 additions & 0 deletions keycloak-artemis/prebuildfs/opt/bitnami/licenses/licenses.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bitnami containers ship with software bundles. You can find the licenses under:
/opt/bitnami/nami/COPYING
/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt
51 changes: 51 additions & 0 deletions keycloak-artemis/prebuildfs/opt/bitnami/scripts/libbitnami.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#
# Bitnami custom library

# shellcheck disable=SC1091

# Load Generic Libraries
. /opt/bitnami/scripts/liblog.sh

# Constants
BOLD='\033[1m'

# Functions

########################
# Print the welcome page
# Globals:
# DISABLE_WELCOME_MESSAGE
# BITNAMI_APP_NAME
# Arguments:
# None
# Returns:
# None
#########################
print_welcome_page() {
if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then
if [[ -n "$BITNAMI_APP_NAME" ]]; then
print_image_welcome_page
fi
fi
}

########################
# Print the welcome page for a Bitnami Docker image
# Globals:
# BITNAMI_APP_NAME
# Arguments:
# None
# Returns:
# None
#########################
print_image_welcome_page() {
local github_url="https://github.com/bitnami/bitnami-docker-${BITNAMI_APP_NAME}"

log ""
log "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}"
log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}"
log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}"
log ""
}

65 changes: 65 additions & 0 deletions keycloak-artemis/prebuildfs/opt/bitnami/scripts/libcomponent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
#
# Library for managing Bitnami components

# Constants
CACHE_ROOT="/tmp/bitnami/pkg/cache"
DOWNLOAD_URL="https://downloads.bitnami.com/files/stacksmith"

# Functions

########################
# Download and unpack a Bitnami package
# Globals:
# OS_NAME
# OS_ARCH
# OS_FLAVOUR
# Arguments:
# $1 - component's name
# $2 - component's version
# Returns:
# None
#########################
component_unpack() {
local name="${1:?name is required}"
local version="${2:?version is required}"
local base_name="${name}-${version}-${OS_NAME}-${OS_ARCH}-${OS_FLAVOUR}"
local package_sha256=""
local directory="/opt/bitnami"

# Validate arguments
shift 2
while [ "$#" -gt 0 ]; do
case "$1" in
-c|--checksum)
shift
package_sha256="${1:?missing package checksum}"
;;
*)
echo "Invalid command line flag $1" >&2
return 1
;;
esac
shift
done

echo "Downloading $base_name package"
if [ -f "${CACHE_ROOT}/${base_name}.tar.gz" ]; then
echo "${CACHE_ROOT}/${base_name}.tar.gz already exists, skipping download."
cp "${CACHE_ROOT}/${base_name}.tar.gz" .
rm "${CACHE_ROOT}/${base_name}.tar.gz"
if [ -f "${CACHE_ROOT}/${base_name}.tar.gz.sha256" ]; then
echo "Using the local sha256 from ${CACHE_ROOT}/${base_name}.tar.gz.sha256"
package_sha256="$(< "${CACHE_ROOT}/${base_name}.tar.gz.sha256")"
rm "${CACHE_ROOT}/${base_name}.tar.gz.sha256"
fi
else
curl --remote-name --silent --show-error --fail "${DOWNLOAD_URL}/${base_name}.tar.gz"
fi
if [ -n "$package_sha256" ]; then
echo "Verifying package integrity"
echo "$package_sha256 ${base_name}.tar.gz" | sha256sum --check - || exit "$?"
fi
tar --directory "${directory}" --extract --gunzip --file "${base_name}.tar.gz" --no-same-owner --strip-components=2
rm "${base_name}.tar.gz"
}
139 changes: 139 additions & 0 deletions keycloak-artemis/prebuildfs/opt/bitnami/scripts/libfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/bin/bash
#
# Library for managing files

# shellcheck disable=SC1091

# Load Generic Libraries
. /opt/bitnami/scripts/libos.sh

# Functions

########################
# Replace a regex-matching string in a file
# Arguments:
# $1 - filename
# $2 - match regex
# $3 - substitute regex
# $4 - use POSIX regex. Default: true
# Returns:
# None
#########################
replace_in_file() {
local filename="${1:?filename is required}"
local match_regex="${2:?match regex is required}"
local substitute_regex="${3:?substitute regex is required}"
local posix_regex=${4:-true}

local result

# We should avoid using 'sed in-place' substitutions
# 1) They are not compatible with files mounted from ConfigMap(s)
# 2) We found incompatibility issues with Debian10 and "in-place" substitutions
local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues
if [[ $posix_regex = true ]]; then
result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
else
result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
fi
echo "$result" > "$filename"
}

########################
# Replace a regex-matching multiline string in a file
# Arguments:
# $1 - filename
# $2 - match regex
# $3 - substitute regex
# Returns:
# None
#########################
replace_in_file_multiline() {
local filename="${1:?filename is required}"
local match_regex="${2:?match regex is required}"
local substitute_regex="${3:?substitute regex is required}"

local result
local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues
result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")"
echo "$result" > "$filename"
}

########################
# Remove a line in a file based on a regex
# Arguments:
# $1 - filename
# $2 - match regex
# $3 - use POSIX regex. Default: true
# Returns:
# None
#########################
remove_in_file() {
local filename="${1:?filename is required}"
local match_regex="${2:?match regex is required}"
local posix_regex=${3:-true}
local result

# We should avoid using 'sed in-place' substitutions
# 1) They are not compatible with files mounted from ConfigMap(s)
# 2) We found incompatibility issues with Debian10 and "in-place" substitutions
if [[ $posix_regex = true ]]; then
result="$(sed -E "/$match_regex/d" "$filename")"
else
result="$(sed "/$match_regex/d" "$filename")"
fi
echo "$result" > "$filename"
}

########################
# Appends text after the last line matching a pattern
# Arguments:
# $1 - file
# $2 - match regex
# $3 - contents to add
# Returns:
# None
#########################
append_file_after_last_match() {
local file="${1:?missing file}"
local match_regex="${2:?missing pattern}"
local value="${3:?missing value}"

# We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again
result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)"
echo "$result" > "$file"
}

########################
# Wait until certain entry is present in a log file
# Arguments:
# $1 - entry to look for
# $2 - log file
# $3 - max retries. Default: 12
# $4 - sleep between retries (in seconds). Default: 5
# Returns:
# Boolean
#########################
wait_for_log_entry() {
local -r entry="${1:-missing entry}"
local -r log_file="${2:-missing log file}"
local -r retries="${3:-12}"
local -r interval_time="${4:-5}"
local attempt=0

check_log_file_for_entry() {
if ! grep -qE "$entry" "$log_file"; then
debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})"
return 1
fi
}
debug "Checking that ${log_file} log file contains entry \"${entry}\""
if retry_while check_log_file_for_entry "$retries" "$interval_time"; then
debug "Found entry \"${entry}\" in ${log_file}"
true
else
error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries"
debug_execute cat "$log_file"
return 1
fi
}
Loading