Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9cb5dea
[feature]: gateway_type
sebasnallar Oct 2, 2025
c5f44ea
aro
sebasnallar Oct 2, 2025
9b7dde8
aro
sebasnallar Oct 2, 2025
78ea065
aro
sebasnallar Oct 2, 2025
eb2d540
feat: update httroutes to do tls termination
javi-null Oct 30, 2025
2134de1
feat: update httroutes to do tls termination
javi-null Oct 30, 2025
b9788de
feat: update httroutes to do tls termination
javi-null Oct 30, 2025
167ed88
feat: add custom-domain label
javi-null Oct 31, 2025
d55fecc
Merge branch 'beta' into aroroute
javi-null Oct 31, 2025
fd14b3c
feat: add private hosted zones support
javi-null Oct 31, 2025
3a4ef93
feat: add private hosted zones support
javi-null Oct 31, 2025
8fe821b
feat: add private hosted zones support
javi-null Oct 31, 2025
674fab7
feat: add private hosted zones support
javi-null Oct 31, 2025
733c545
feat: add private hosted zones support
javi-null Oct 31, 2025
8fe4728
feat: use azure dns providers keys
javi-null Oct 31, 2025
50134bb
feat: use azure dns providers keys
javi-null Oct 31, 2025
ebe49fb
feat: use azure dns providers keys
javi-null Oct 31, 2025
4c194f9
feat: use azure dns providers keys
javi-null Oct 31, 2025
0683bc3
feat: use azure dns providers keys
javi-null Oct 31, 2025
0cd8c85
feat: use azure dns providers keys
javi-null Oct 31, 2025
f1b284e
fix: private dns recordset
javi-null Nov 3, 2025
9efcac1
fix: use gateway name
javi-null Nov 3, 2025
976c687
fix: polish code
javi-null Nov 3, 2025
8769b42
fix: add route labels
javi-null Nov 4, 2025
9a58f9a
correctly extract hosted zones from azure configuration
fedemaleh Nov 4, 2025
0d0a487
read azure dns configuration from providers
fedemaleh Nov 4, 2025
65c826b
fix read data from providers
fedemaleh Nov 4, 2025
6bf4488
use correct api version for private dns zone
fedemaleh Nov 4, 2025
6d7cd23
use private visibility for private domain
fedemaleh Nov 4, 2025
9fdd498
do not internal dns for public scopes
fedemaleh Nov 5, 2025
f9caac7
create internal record for public scopes
fedemaleh Nov 5, 2025
2f116aa
fix aro route annotations
fedemaleh Nov 5, 2025
770572f
Disable sticky sessions
fedemaleh Nov 5, 2025
8cde55f
Add logic to create applications
fedemaleh Nov 7, 2025
b65cd98
feat: add debug logs
javi-null Nov 10, 2025
44acc87
feat: add debug logs
javi-null Nov 10, 2025
4f6cc35
feat: add debug logs
javi-null Nov 10, 2025
0f55051
feat: add debug logs
javi-null Nov 10, 2025
18d1373
feat: add debug logs
javi-null Nov 10, 2025
d64a3da
feat: add debug logs
javi-null Nov 10, 2025
d72fb91
feat: restablish no output
javi-null Nov 10, 2025
ea67669
feat: override workflow for openshift token
javi-null Nov 10, 2025
4143def
feat: remove file logging
javi-null Nov 10, 2025
9c85505
Merge feature/create-applications
fedemaleh Nov 12, 2025
048deef
Merge branch 'beta' into aroroute
javi-null Nov 14, 2025
341efd8
Add latest applications code
fedemaleh Nov 17, 2025
0744f96
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
9fe575f
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
e5a9065
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
82fce95
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
b08a8b8
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
9418016
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
f3e7645
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
ccd2bcc
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
c37a763
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
9ce2039
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
3d27fdc
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
05f2df9
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
6f9d5c4
feat(metrics): add debug for prometheus operator
violenti Nov 25, 2025
3ed08cb
feat: remove debug
violenti Nov 27, 2025
b88ecc4
fix: remove echo
javi-null Nov 27, 2025
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
63 changes: 63 additions & 0 deletions application/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

CLEAN_CONTEXT=$(echo "$NP_ACTION_CONTEXT" | sed "s/^'//;s/'$//")

export NP_ACTION_CONTEXT="$CLEAN_CONTEXT"

CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")

cd "$CURRENT_DIR" && cd ..

TOKEN=$(np token create --body "{\"api_key\": \"$NP_API_KEY\"}" --format json | jq -r .access_token)

CALLBACK_URL=$(echo "$NP_ACTION_CONTEXT" | jq -r .notification.callback_url)

logs=$(np service workflow exec --workflow application/workflows/create_app.yaml)
EXIT_CODE=$?
# Determine status based on exit code
if [ $EXIT_CODE -eq 0 ]; then
STATUS="success"
else
STATUS="failed"
fi

timestamp=$(($(date +%s) * 1000))

messages=$(echo "$logs" | while IFS= read -r line; do
[[ -z "$line" ]] && continue

if [[ "$line" =~ "failed" ]] || [[ "$line" =~ "ERROR" ]] || [[ "$line" =~ "error" ]]; then
level="ERROR"
elif [[ "$line" =~ "warning" ]] || [[ "$line" =~ "WARNING" ]] || [[ "$line" =~ "warn" ]]; then
level="WARNING"
else
level="INFO"
fi

jq -n \
--arg level "$level" \
--arg message "$line" \
--arg ts "$timestamp" \
'{level: $level, message: $message, timestamp: ($ts | tonumber)}'
done | jq -s '.')

payload=$(jq -n \
--arg status "$STATUS" \
--argjson messages "$messages" \
'{status: $status, messages: $messages}')

echo "$payload" | jq .

echo "Updating hook with status: $STATUS. URL: $CALLBACK_URL"

# Call the callback URL with the status
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH "$CALLBACK_URL" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "$payload")

if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
echo "✓ Successfully updated hook (HTTP $HTTP_CODE)"
else
echo "✗ Failed to update hook (HTTP $HTTP_CODE)"
fi
21 changes: 21 additions & 0 deletions application/scripts/asset-repo/create_asset_repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

ASSET_REPOSITORY=$(np provider list --categories assets-repository --nrn "$NRN" --format json | jq ".results[0]")

if [[ -n "$ASSET_REPOSITORY_PROVIDER" ]]; then
echo "Using ASSET_REPOSITORY_PROVIDER from environment: $ASSET_REPOSITORY_PROVIDER"
else
ASSET_REPOSITORY_SPEC=$(echo "$ASSET_REPOSITORY" | jq -r .specification_id)
ASSET_REPOSITORY_PROVIDER=$(np provider specification read --id "$ASSET_REPOSITORY_SPEC" --format json | jq -r .slug)

echo "No ASSET_REPOSITORY_PROVIDER configured from environment, will use the provider configured in platform settings: $ASSET_REPOSITORY_PROVIDER"
fi

ASSET_REPOSITORY_SCRIPT_PATH="application/scripts/asset-repo/$ASSET_REPOSITORY_PROVIDER"

export ASSET_REPOSITORY_TYPE
export ASSET_REPOSITORY

export ASSET_REPOSITORY_SCRIPT_PATH

np service workflow exec --workflow application/workflows/create_asset_repository.yaml
27 changes: 27 additions & 0 deletions application/scripts/asset-repo/docker-server/build_context
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [[ -n "$DOCKER_SERVER_URL" ]]; then
echo "Using DOCKER_SERVER_URL from environment: $DOCKER_SERVER_URL"
else
DOCKER_SERVER_URL=$(echo "$ASSET_REPOSITORY" | jq -r '.attributes.setup.server')
echo "No DOCKER_SERVER_URL in environment, using value from platform: $DOCKER_SERVER_URL"
fi

if [[ -n "$DOCKER_SERVER_PATH" ]]; then
echo "Using DOCKER_SERVER_PATH from environment: $DOCKER_SERVER_PATH"
else
DOCKER_SERVER_PATH=$(echo "$ASSET_REPOSITORY" | jq -r '.attributes.setup.path')
echo "No DOCKER_SERVER_PATH in environment, using value from platform: $DOCKER_SERVER_PATH"
fi

if [[ -n "$DOCKER_SERVER_USE_NAMESPACE" ]]; then
echo "Using DOCKER_SERVER_USE_NAMESPACE from environment: $DOCKER_SERVER_USE_NAMESPACE"
else
DOCKER_SERVER_USE_NAMESPACE=$(echo "$ASSET_REPOSITORY" | jq -r '.attributes.setup.use_namespace')
echo "No DOCKER_SERVER_USE_NAMESPACE in environment, using value from platform: $DOCKER_SERVER_USE_NAMESPACE"
fi


export DOCKER_SERVER_URL
export DOCKER_SERVER_PATH
export DOCKER_SERVER_USE_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

np nrn patch --nrn "$NRN" --body "{\"docker.repository_uri\":\"$DOCKER_SERVER_URI\"}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

DOCKER_SERVER_URI=$DOCKER_SERVER_URL

if [[ ! -z "$DOCKER_SERVER_PATH" ]]; then
DOCKER_SERVER_URI="$DOCKER_SERVER_URI/$DOCKER_SERVER_PATH"
fi

SEPARATOR="-"
if [[ "$DOCKER_SERVER_USE_NAMESPACE" == "true" ]]; then
SEPARATOR="/"
fi

DOCKER_SERVER_URI="$DOCKER_SERVER_URI/$NAMESPACE_SLUG$SEPARATOR$APPLICATION_SLUG"

export DOCKER_SERVER_URI
25 changes: 25 additions & 0 deletions application/scripts/base_context
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

NRN=$(echo "$NP_ACTION_CONTEXT" | jq -r .notification.nrn)

ACCOUNT_ID=$(echo "$NRN" | sed -n 's/.*account=\([0-9]*\).*/\1/p')
NAMESPACE_ID=$(echo "$NRN" | sed -n 's/.*namespace=\([0-9]*\).*/\1/p')
APPLICATION_ID=$(echo "$NRN" | sed -n 's/.*application=\([0-9]*\).*/\1/p')

NAMESPACE=$(np namespace read --format json --id "$NAMESPACE_ID")

APPLICATION=$(np application read --format json --id "$APPLICATION_ID")

APPLICATION_SLUG=$(echo "$APPLICATION" | jq -r .slug)
NAMESPACE_SLUG=$(echo "$NAMESPACE" | jq -r .slug)

export ACCOUNT_ID

export NAMESPACE
export NAMESPACE_ID
export NAMESPACE_SLUG

export APPLICATION
export APPLICATION_ID
export APPLICATION_SLUG
export NRN
45 changes: 45 additions & 0 deletions application/scripts/code-repo/create_code_repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")

REPOSITORY_URL=$(echo "$APPLICATION" | jq -r .repository_url)
TEMPLATE_ID=$(echo "$APPLICATION" | jq -r '.template_id // empty' )

if [[ -n "$TEMPLATE_ID" ]]; then
CODE_REPOSITORY_STRATEGY=create

TEMPLATE_URL=$(np template read --id "$TEMPLATE_ID" --format json | jq -r .url)

export TEMPLATE_URL
else
CODE_REPOSITORY_STRATEGY=import
fi

REPOSITORY_NAME=$(basename "$REPOSITORY_URL")

if [[ -n "$CODE_REPOSITORY_PROVIDER" ]]; then
echo "Using CODE_REPOSITORY_PROVIDER from environment: $CODE_REPOSITORY_PROVIDER"
else
ACCOUNT=$(np account read --id "$ACCOUNT_ID" --format json)

CODE_REPOSITORY_PROVIDER=$(echo "$ACCOUNT" | jq -r .repository_provider)

echo "No CODE_REPOSITORY_PROVIDER configured from environment, will use the provider configured in the nullplatform account: $CODE_REPOSITORY_PROVIDER"
fi

CODE_REPOSITORY=$(np provider list --categories code-repository --nrn "$NRN" --format json | jq ".results[0]")

CODE_REPOSITORY_SCRIPT_PATH="application/scripts/code-repo/$CODE_REPOSITORY_PROVIDER"

CODE_REPOSITORY_COLLABORATORS=$(echo "$CODE_REPOSITORY" | jq .attributes.access.default_collaborators)

export CODE_REPOSITORY_STRATEGY

export REPOSITORY_URL
export REPOSITORY_NAME

export CODE_REPOSITORY
export CODE_REPOSITORY_SCRIPT_PATH
export CODE_REPOSITORY_COLLABORATORS

np service workflow exec --workflow application/workflows/create_code_repository.yaml
33 changes: 33 additions & 0 deletions application/scripts/code-repo/generate_secrets
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
CI_ROLE_ID=1855672260
# TODO(federico.maleh) missing support for mono repo
# TODO(federico.maleh) missing support for extra secrets
# TODO(federico.maleh) missing support for extra roles in api key

API_KEY_NAME="ci-$NAMESPACE_SLUG-$NAMESPACE_ID-$APPLICATION_SLUG-$APPLICATION_ID"

echo "Creating api key for ci: $API_KEY_NAME"

API_KEY_BODY=$(jq -nc \
--arg name "$API_KEY_NAME" \
--arg nrn "$NRN" \
--argjson role_id "$CI_ROLE_ID" \
'{name: $name, grants: [{nrn: $nrn, role_id: $role_id}], tags: [{key: "ci", value: true}], internal: true}')

API_KEY_RESPONSE=$(np api-key create --format json --body "$API_KEY_BODY")

API_KEY=$(echo "$API_KEY_RESPONSE" | jq -r .api_key)
API_KEY_ID=$(echo "$API_KEY_RESPONSE" | jq -r .id)

if [[ -n "$API_KEY_ID" ]]; then
echo "Created ci api key: $API_KEY_ID"
else
echo "Error creating ci api key"
echo "$API_API_KEY_RESPONSE" | jq

exit 1
fi

CODE_REPOSITORY_SECRETS="{\"NP_API_KEY\": \"$API_KEY\"}"

export CODE_REPOSITORY_SECRETS
74 changes: 74 additions & 0 deletions application/scripts/code-repo/gitlab/add_collaborators
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

PROJECT_PATH="${GITLAB_ENCODED_GROUP_PATH}%2F${REPOSITORY_NAME}"

get_access_level() {
local role="$1" # Don't convert to uppercase
case $role in
guest) echo "10" ;;
reporter) echo "20" ;;
developer) echo "30" ;;
maintainer) echo "40" ;;
owner) echo "50" ;;
*) echo "30" ;; # default to DEVELOPER
esac
}

# Function to get user ID from username
get_user_id() {
local username="$1"
curl --silent --header "PRIVATE-TOKEN: ${GITLAB_ACCESS_TOKEN}" \
"${GITLAB_INSTALLATION_URL}/api/v4/users?username=${username}" | jq -r '.[0].id'
}

# Function to get group ID from group path
get_group_id() {
local group_path="$1"

curl --silent --header "PRIVATE-TOKEN: ${GITLAB_ACCESS_TOKEN}" \
"${GITLAB_INSTALLATION_URL}/api/v4/groups/${group_path}" | jq -r '.id'
}

echo "$CODE_REPOSITORY_COLLABORATORS" | jq -c '.[]' | while read -r collaborator; do
id=$(echo "$collaborator" | jq -r '.id')
role=$(echo "$collaborator" | jq -r '.role')
type=$(echo "$collaborator" | jq -r '.type')
access_level=$(get_access_level "$role")

if [ "$type" = "user" ]; then
# Look up user ID from username
user_id=$(get_user_id "$id")

if [ "$user_id" = "null" ] || [ -z "$user_id" ]; then
echo "Error: User '$id' not found"
continue
fi

echo "Adding user '$id' (ID: $user_id) with role '$role' (access_level=$access_level)"

curl --request POST \
--header "PRIVATE-TOKEN: ${GITLAB_ACCESS_TOKEN}" \
--data "user_id=${user_id}&access_level=${access_level}" \
"${GITLAB_INSTALLATION_URL}/api/v4/projects/${PROJECT_PATH}/members"
echo ""

elif [ "$type" = "group" ]; then
# Look up group ID from group path
group_id=$(get_group_id "$id")

if [ "$group_id" = "null" ] || [ -z "$group_id" ]; then
echo "Error: Group '$id' not found"
continue
fi

echo "Adding group '$id' (ID: $group_id) with role '$role' (access_level=$access_level)"

curl --request POST \
--header "PRIVATE-TOKEN: ${GITLAB_ACCESS_TOKEN}" \
--data "group_id=${group_id}&group_access=${access_level}" \
"${GITLAB_INSTALLATION_URL}/api/v4/projects/${PROJECT_PATH}/share"
echo ""
fi
done

echo "Finished adding collaborators"
44 changes: 44 additions & 0 deletions application/scripts/code-repo/gitlab/build_context
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

if [[ -n "$GITLAB_ACCESS_TOKEN" ]]; then
echo "Using GITLAB_ACCESS_TOKEN from environment (hidden)"
else
GITLAB_ACCESS_TOKEN=$(echo "$CODE_REPOSITORY" | jq -r '.attributes.setup.access_token')
echo "No GITLAB_ACCESS_TOKEN in environment, using value from platform (hidden)"
fi

if [[ -n "$GITLAB_GROUP_PATH" ]]; then
echo "Using GITLAB_GROUP_PATH from environment: $GITLAB_GROUP_PATH"
else
GITLAB_GROUP_PATH=$(echo "$CODE_REPOSITORY" | jq -r '.attributes.setup.group_path')
echo "No GITLAB_GROUP_PATH in environment, using value from platform: $GITLAB_GROUP_PATH"
fi

if [[ -n "$GITLAB_INSTALLATION_URL" ]]; then
echo "Using GITLAB_INSTALLATION_URL from environment: $GITLAB_INSTALLATION_URL"
else
GITLAB_INSTALLATION_URL=$(echo "$CODE_REPOSITORY" | jq -r '.attributes.setup.installation_url')
echo "No GITLAB_INSTALLATION_URL in environment, using value from platform: $GITLAB_INSTALLATION_URL"
fi


echo "Getting group ID for path: $GITLAB_GROUP_PATH"
GROUP_RESPONSE=$(curl -s --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" \
"${GITLAB_INSTALLATION_URL}/api/v4/groups?search=${GITLAB_GROUP_PATH}")

GITLAB_GROUP_ID=$(echo "$GROUP_RESPONSE" | jq -r ".[] | select(.full_path == \"${GITLAB_GROUP_PATH}\") | .id")

if [ -z "$GITLAB_GROUP_ID" ] || [ "$GITLAB_GROUP_ID" == "null" ]; then
echo "Error: Group not found for path: $GITLAB_GROUP_PATH"
exit 1
fi

echo "Found gitlab Group ID: $GITLAB_GROUP_ID"

GITLAB_ENCODED_GROUP_PATH=$(echo "$GITLAB_GROUP_PATH" | sed 's/\//%2F/g')

export GITLAB_ACCESS_TOKEN
export GITLAB_GROUP_PATH
export GITLAB_INSTALLATION_URL
export GITLAB_GROUP_ID
export GITLAB_ENCODED_GROUP_PATH
Loading