Skip to content

Commit

Permalink
kinit
Browse files Browse the repository at this point in the history
Signed-off-by: Leandro Mendes <[email protected]>
  • Loading branch information
theflockers committed Dec 18, 2024
1 parent 847751b commit a06adf6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
29 changes: 26 additions & 3 deletions internal/tasks/update-fbc-catalog-task/tests/mocks.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
#!/bin/bash
set -eux

# need a seed
SEED='
---
id: 1
distribution_scope: "stage"
fbc_fragment: "registry.io/image0@sha256:0000"
internal_index_image_copy: "registry-proxy-stage.engineering.redhat.com/rh-osbs-stage/iib:1"
logs:
url: "https://fakeiib.host/api/v1/builds/1/logs"
request_type: "fbc-operations"
state: "complete"
state_reason: ""
state_history:
- state: "in_progress"
state_reason: "The request was initiated"
user: "iib@kerberos"'

success_state_reason="The FBC fragment was successfully added in the index image"
seed="build-seed.yaml"
function curl() {
echo $@
# yq "$seed" -o json | jq --argjson progress '{ "state": "completed", "state_reason": "cabo"}' '.state_history += [$progress]
yq -o json <<< $SEED | jq --argjson progress '{ "state": "completed", "state_reason": "The FBC fragment was successfully added in the index image"}' '.state_history += [$progress]'
}

function base64() {
echo "decrypted-keytab"
}

function kinit() {
echo "Ok"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
# Add RBAC so that the SA executing the tests can retrieve CRs
kubectl apply -f .github/resources/crd_rbac.yaml

# create required secrets
kubectl create secret generic iib-service-account-secret \
--from-literal=principal="iib@kerberos" \
--from-literal=keytab="something"
kubectl create secret generic iib-services-config \
--from-literal=krb5.conf="" \
--from-literal=url="https://fakeiib.host"

kubectl create secret generic iib-overwrite-fromimage-credentials \
--from-literal=username="bot+user" \
--from-literal=token="token"
# Add mocks to the beginning of task step script
TASK_PATH="$1"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pipeline
metadata:
name: test-update-fbc-catalog-default
spec:
description: Test
description: Test
tasks:
- name: run-task
taskRef:
Expand All @@ -14,12 +14,12 @@ spec:
value: "registry.io/image0@sha256:0000"
- name: fromIndex
value: "quay.io/scoheb/fbc-index-testing:latest"
- name: buildTags
- name: buildTags
value: "[]"
- name: addArches
value: "[]"
- name: iibServiceAccountSecret
value: "iib-account-secret"
value: "iib-service-account-secret"
- name: check-result
taskSpec:
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ spec:
export KRB5_CONFIG="${KRB5_TEMP_CONF}"
export KRB5_TRACE=/dev/stderr
/usr/bin/kinit -V "${KRB5_PRINCIPAL}" -k -t /tmp/keytab
kinit -V "${KRB5_PRINCIPAL}" -k -t /tmp/keytab
set -x
# check if this fbc fragment is opt-in
Expand Down

0 comments on commit a06adf6

Please sign in to comment.