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

look up environment variables instead of passing as extra-args #189

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
6 changes: 4 additions & 2 deletions e2e/provision/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ BRANCH=${NEPHIO_BRANCH:-$(get_metadata nephio-test-infra-branch "main")}
NEPHIO_USER=${NEPHIO_USER:-$(get_metadata nephio-user "ubuntu")}
HOME=${NEPHIO_HOME:-/home/$NEPHIO_USER}
REPO_DIR=${NEPHIO_REPO_DIR:-$HOME/test-infra}
DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME:-""}
DOCKERHUB_TOKEN=${DOCKERHUB_TOKEN:-""}

echo "$DEBUG, $DEPLOYMENT_TYPE, $RUN_E2E, $REPO, $BRANCH, $NEPHIO_USER, $HOME, $REPO_DIR"
echo "$DEBUG, $DEPLOYMENT_TYPE, $RUN_E2E, $REPO, $BRANCH, $NEPHIO_USER, $HOME, $REPO_DIR, $DOCKERHUB_USERNAME, $DOCKERHUB_TOKEN"
trap get_status ERR

if ! command -v git >/dev/null; then
Expand Down Expand Up @@ -105,7 +107,7 @@ sed -e "s/vagrant/$NEPHIO_USER/" <"$REPO_DIR/e2e/provision/nephio.yaml" >"$HOME/
# Sandbox Creation
int_start=$(date +%s)
cd "$REPO_DIR/e2e/provision"
export DEBUG DEPLOYMENT_TYPE
export DEBUG DEPLOYMENT_TYPE DOCKERHUB_USERNAME DOCKERHUB_TOKEN
runuser -u "$NEPHIO_USER" ./install_sandbox.sh
printf "%s secs\n" "$(($(date +%s) - int_start))"

Expand Down
24 changes: 24 additions & 0 deletions e2e/provision/playbooks/roles/bootstrap/tasks/prep-gitea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@
metadata:
name: "{{ gitea.k8s.namespace }}"

- name: Create docker hub secret
when:
- lookup('ansible.builtin.env', 'DOCKERHUB_USERNAME') | length > 0
- lookup('ansible.builtin.env', 'DOCKERHUB_TOKEN') | length > 0
vars:
username: "{{ lookup('ansible.builtin.env', 'DOCKERHUB_USERNAME') }}"
token: "{{ lookup('ansible.builtin.env', 'DOCKERHUB_TOKEN') }}"
block:
- name: Create docker-registry secret
ansible.builtin.shell: kubectl create secret docker-registry dockerhub --docker-username={{ username }} --docker-password={{ token }} -n {{ gitea.k8s.namespace }}
vjayaramrh marked this conversation as resolved.
Show resolved Hide resolved
- name: Create docker-registry service account
no_log: true
kubernetes.core.k8s:
context: "{{ k8s.context }}"
state: present
definition:
apiVersion: v1
kind: ServiceAccount
imagePullSecrets:
- name: dockerhub
metadata:
name: default
namespace: "{{ gitea.k8s.namespace }}"

- name: Create gitea postgresql user password
kubernetes.core.k8s:
context: "{{ k8s.context }}"
Expand Down