Skip to content

Commit

Permalink
fix sed calls for macOS
Browse files Browse the repository at this point in the history
Signed-off-by: lugi0 <[email protected]>
  • Loading branch information
lugi0 committed Jun 12, 2024
1 parent fa28501 commit 77b8d09
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 61 deletions.
16 changes: 8 additions & 8 deletions ods_ci/build/install_idp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ function set_htpasswd_users_and_login(){
OAUTH_HTPASSWD_JSON="$(cat ods_ci/configs/resources/oauth_htp_idp.json)"
oc patch oauth cluster --type json -p '[{"op": "add", "path": "/spec/identityProviders/-", "value": '"$OAUTH_HTPASSWD_JSON"'}]'
cp ods_ci/configs/templates/ca-rolebinding.yaml ods_ci/configs/ca-rolebinding.yaml
sed -i "s/<rolebinding_name>/ods-ci-htp-admin/g" ods_ci/configs/ca-rolebinding.yaml
sed -i "s/<username>/$cluster_adm_user/g" ods_ci/configs/ca-rolebinding.yaml
sed -i'' -e "s/<rolebinding_name>/ods-ci-htp-admin/g" ods_ci/configs/ca-rolebinding.yaml
sed -i'' -e "s/<username>/$cluster_adm_user/g" ods_ci/configs/ca-rolebinding.yaml
oc apply -f ods_ci/configs/ca-rolebinding.yaml
fi
# login using htpasswd
Expand Down Expand Up @@ -196,12 +196,12 @@ function set_ldap_users(){
# update ldap.yaml with creds
echo "--> configuring LDAP server and users"
cp ods_ci/configs/templates/ldap/ldap.yaml ods_ci/configs/ldap.yaml
sed -i "s/<users_string>/$users_base64/g" ods_ci/configs/ldap.yaml
sed -i "s/<passwords_string>/$rand_base64/g" ods_ci/configs/ldap.yaml
sed -i'' -e "s/<users_string>/$users_base64/g" ods_ci/configs/ldap.yaml
sed -i'' -e "s/<passwords_string>/$rand_base64/g" ods_ci/configs/ldap.yaml
rand=$(generate_rand_string)
export RAND_ADMIN=$rand
rand_base64=$(echo -n $rand | base64 -w 0)
sed -i "s/<adminpassword>/$rand_base64/g" ods_ci/configs/ldap.yaml
sed -i'' -e "s/<adminpassword>/$rand_base64/g" ods_ci/configs/ldap.yaml

# create ldap deployment
oc apply -f ods_ci/configs/ldap.yaml
Expand All @@ -214,9 +214,9 @@ function set_ldap_users(){
exit 1
fi
cp ods_ci/utils/scripts/ocm/templates/create_ldap_idp.jinja ods_ci/configs/create_ldap_idp.jinja
sed -i "s/{{ LDAP_BIND_PASSWORD }}/$RAND_ADMIN/g" ods_ci/configs/create_ldap_idp.jinja
sed -i "s/{{ LDAP_BIND_DN }}/cn=admin,dc=example,dc=org/g" ods_ci/configs/create_ldap_idp.jinja
sed -i 's/{{ LDAP_URL }}/ldap:\/\/openldap.openldap.svc.cluster.local:1389\/dc=example,dc=org?uid/g' ods_ci/configs/create_ldap_idp.jinja
sed -i'' -e "s/{{ LDAP_BIND_PASSWORD }}/$RAND_ADMIN/g" ods_ci/configs/create_ldap_idp.jinja
sed -i'' -e "s/{{ LDAP_BIND_DN }}/cn=admin,dc=example,dc=org/g" ods_ci/configs/create_ldap_idp.jinja
sed -i'' -e 's/{{ LDAP_URL }}/ldap:\/\/openldap.openldap.svc.cluster.local:1389\/dc=example,dc=org?uid/g' ods_ci/configs/create_ldap_idp.jinja
ocm post /api/clusters_mgmt/v1/clusters/${ocm_clusterid}/identity_providers --body=ods_ci/configs/create_ldap_idp.jinja
else
oc create secret generic ldap-bind-password --from-literal=bindPassword="$RAND_ADMIN" -n openshift-config
Expand Down
2 changes: 1 addition & 1 deletion ods_ci/tasks/Resources/Provisioning/GPU/gpu_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CHANNEL="$(oc get packagemanifest gpu-operator-certified -n openshift-marketplac

CSVNAME="$(oc get packagemanifests/gpu-operator-certified -n openshift-marketplace -o json | jq -r '.status.channels[] | select(.name == "'$CHANNEL'") | .currentCSV')"

sed -i -e "0,/v1.11/s//$CHANNEL/g" -e "s/gpu-operator-certified.v1.11.0/$CSVNAME/g" "$GPU_INSTALL_DIR/gpu_install.yaml"
sed -i'' -e "0,/v1.11/s//$CHANNEL/g" -e "s/gpu-operator-certified.v1.11.0/$CSVNAME/g" "$GPU_INSTALL_DIR/gpu_install.yaml"

oc apply -f "$GPU_INSTALL_DIR/gpu_install.yaml"
oc apply -f "$GPU_INSTALL_DIR/nfd_operator.yaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jq -r --arg INSTANCE_TYPE "$INSTANCE_TYPE" '.spec.template.spec.providerSpec.val
' /tmp/source-machineset.json > /tmp/gpu-machineset.json

# Change machineset name
sed -i "s/$OLD_MACHINESET_NAME/$NEW_MACHINESET_NAME/g" /tmp/gpu-machineset.json
sed -i'' -e "s/$OLD_MACHINESET_NAME/$NEW_MACHINESET_NAME/g" /tmp/gpu-machineset.json
# Create new machineset
oc apply -f /tmp/gpu-machineset.json
rm /tmp/source-machineset.json
Expand Down
28 changes: 14 additions & 14 deletions ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Install RHODS
${file_path} = Set Variable tasks/Resources/RHODS_OLM/install/
Copy File source=${file_path}cs_template.yaml destination=${file_path}cs_apply.yaml
IF "${PRODUCT}" == "ODH"
Run sed -i 's/<CATALOG_SOURCE>/community-operators/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<CATALOG_SOURCE>/community-operators/' ${file_path}cs_apply.yaml
ELSE
Run sed -i 's/<CATALOG_SOURCE>/redhat-operators/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<CATALOG_SOURCE>/redhat-operators/' ${file_path}cs_apply.yaml
END
Run sed -i 's/<OPERATOR_NAME>/${OPERATOR_NAME}/' ${file_path}cs_apply.yaml
Run sed -i 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}cs_apply.yaml
Run sed -i 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAME>/${OPERATOR_NAME}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}cs_apply.yaml
Oc Apply kind=List src=${file_path}cs_apply.yaml
Remove File ${file_path}cs_apply.yml
ELSE
Expand Down Expand Up @@ -240,9 +240,9 @@ Create DSCInitialization CustomResource Using Test Variables
[Arguments] ${dsci_name}=${DSCI_NAME}
${file_path} = Set Variable tasks/Resources/Files/
Copy File source=${file_path}dsci_template.yml destination=${file_path}dsci_apply.yml
Run sed -i 's/<dsci_name>/${dsci_name}/' ${file_path}dsci_apply.yml
Run sed -i 's/<application_namespace>/${APPLICATIONS_NAMESPACE}/' ${file_path}dsci_apply.yml
Run sed -i 's/<monitoring_namespace>/${MONITORING_NAMESPACE}/' ${file_path}dsci_apply.yml
Run sed -i'' -e 's/<dsci_name>/${dsci_name}/' ${file_path}dsci_apply.yml
Run sed -i'' -e 's/<application_namespace>/${APPLICATIONS_NAMESPACE}/' ${file_path}dsci_apply.yml
Run sed -i'' -e 's/<monitoring_namespace>/${MONITORING_NAMESPACE}/' ${file_path}dsci_apply.yml

Wait For DSCInitialization CustomResource To Be Ready
[Documentation] Wait for DSCInitialization CustomResource To Be Ready
Expand Down Expand Up @@ -298,14 +298,14 @@ Create DataScienceCluster CustomResource Using Test Variables
[Arguments] ${dsc_name}=${DSC_NAME}
${file_path} = Set Variable tasks/Resources/Files/
Copy File source=${file_path}dsc_template.yml destination=${file_path}dsc_apply.yml
Run sed -i 's/<dsc_name>/${dsc_name}/' ${file_path}dsc_apply.yml
Run sed -i'' -e 's/<dsc_name>/${dsc_name}/' ${file_path}dsc_apply.yml
FOR ${cmp} IN @{COMPONENT_LIST}
IF $cmp not in $COMPONENTS
Run sed -i 's/<${cmp}_value>/Removed/' ${file_path}dsc_apply.yml
Run sed -i'' -e 's/<${cmp}_value>/Removed/' ${file_path}dsc_apply.yml
ELSE IF '${COMPONENTS.${cmp}}' == 'Managed'
Run sed -i 's/<${cmp}_value>/Managed/' ${file_path}dsc_apply.yml
Run sed -i'' -e 's/<${cmp}_value>/Managed/' ${file_path}dsc_apply.yml
ELSE IF '${COMPONENTS.${cmp}}' == 'Removed'
Run sed -i 's/<${cmp}_value>/Removed/' ${file_path}dsc_apply.yml
Run sed -i'' -e 's/<${cmp}_value>/Removed/' ${file_path}dsc_apply.yml
END
END

Expand All @@ -318,9 +318,9 @@ Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables
IF $cmp in $CUSTOM_MANIFESTS
${manifest_string}= Convert To String ${CUSTOM_MANIFESTS}[${cmp}]
# Use sed to replace the placeholder with the YAML string
Run sed -i "s|<${cmp}_devflags>|${manifest_string}|g" ${file_path}dsc_apply.yml
Run sed -i'' -e "s|<${cmp}_devflags>|${manifest_string}|g" ${file_path}dsc_apply.yml
ELSE
Run sed -i "s|<${cmp}_devflags>||g" ${file_path}dsc_apply.yml
Run sed -i'' -e "s|<${cmp}_devflags>||g" ${file_path}dsc_apply.yml
END
END

Expand Down
14 changes: 7 additions & 7 deletions ods_ci/tests/Resources/CLI/ModelServing/llm.resource
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ Create Secret For S3-Like Buckets
${endpoint_escaped}= Escape String Chars str=${endpoint}
${accesskey_escaped}= Escape String Chars str=${access_key}
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{ENDPOINT}}/${endpoint_escaped}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{ENDPOINT}}/${endpoint_escaped}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{USE_HTTPS}}/${use_https}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{USE_HTTPS}}/${use_https}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{REGION}}/${region}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{REGION}}/${region}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{ACCESS_KEY_ID}}/${access_key_id}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{ACCESS_KEY_ID}}/${access_key_id}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{SECRET_ACCESS_KEY}}/${accesskey_escaped}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{SECRET_ACCESS_KEY}}/${accesskey_escaped}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{NAME}}/${name}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
... sed -i'' -e 's/{{NAME}}/${name}/g' ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... sed -i 's/{{NAME}}/${sa_name}/g' ${LLM_RESOURCES_DIRPATH}/bucket_sa_filled.yaml
... sed -i'' -e 's/{{NAME}}/${sa_name}/g' ${LLM_RESOURCES_DIRPATH}/bucket_sa_filled.yaml
${rc} ${out}= Run And Return Rc And Output
... oc apply -f ${LLM_RESOURCES_DIRPATH}/bucket_secret_filled.yaml -n ${namespace}
Should Be Equal As Integers ${rc} ${0}
Expand Down
18 changes: 9 additions & 9 deletions ods_ci/tests/Resources/Page/Operators/ISVs.resource
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Install ISV Operator From OperatorHub Via CLI # robocop: disable
END
${operator_sub_filepath}= Set Variable ${FILES_RESOURCES_DIRPATH}/${operator_name}-sub.yaml
Copy File ${SUBSCRIPTION_YAML_TEMPLATE_FILEPATH} ${operator_sub_filepath}
${rc} ${out}= Run And Return Rc And Output sed -i "s/<SUBSCRIPTION_NAME>/${subscription_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<OPERATOR_NAMESPACE>/${namespace}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<UPDATE_CHANNEL>/${channel}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<OPERATOR_NAME>/${operator_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<CATALOG_SOURCE>/${catalog_source_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<CS_NAMESPACE>/${cs_namespace}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<SUBSCRIPTION_NAME>/${subscription_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<OPERATOR_NAMESPACE>/${namespace}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<UPDATE_CHANNEL>/${channel}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<OPERATOR_NAME>/${operator_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<CATALOG_SOURCE>/${catalog_source_name}/g" ${operator_sub_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<CS_NAMESPACE>/${cs_namespace}/g" ${operator_sub_filepath} # robocop: disable
Oc Apply kind=Subscription src=${operator_sub_filepath}


Expand All @@ -40,9 +40,9 @@ Create Operator Group
[Arguments] ${name} ${namespace} ${target_namespace} ${operator_name}
${operator_group_filepath}= Set Variable ${FILES_RESOURCES_DIRPATH}/${operator_name}-group.yaml # robocop: disable
Copy File ${OPERATORGROUP_YAML_TEMPLATE_FILEPATH} ${operator_group_filepath}
${rc} ${out}= Run And Return Rc And Output sed -i "s/<BASE_NAME>/${name}/g" ${operator_group_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<NAMESPACE>/${namespace}/g" ${operator_group_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i "s/<TARGET_NAMESPACE>/${target_namespace}/g" ${operator_group_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<BASE_NAME>/${name}/g" ${operator_group_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<NAMESPACE>/${namespace}/g" ${operator_group_filepath} # robocop: disable
${rc} ${out}= Run And Return Rc And Output sed -i'' -e "s/<TARGET_NAMESPACE>/${target_namespace}/g" ${operator_group_filepath} # robocop: disable
Oc Apply kind=OperatorGroup src=${operator_group_filepath} api_version=v1
IF "${target_namespace}" == "${NONE}"
${rc} ${out}= Run And Return Rc And Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ Install RHOAI For KserveRaw
Log ${out} console=yes
${image_escaped} = Escape Forward Slashes ${image_url}
Copy File source=${file_path}cs_template.yaml destination=${file_path}cs_apply.yaml
Run sed -i 's/<OPERATOR_NAMESPACE>/openshift-marketplace/' ${file_path}cs_apply.yaml
Run sed -i 's/<IMAGE_URL>/${image_escaped}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/openshift-marketplace/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<IMAGE_URL>/${image_escaped}/' ${file_path}cs_apply.yaml
${rc} ${out} = Run And Return Rc And Output oc apply -f ${file_path}cs_apply.yaml
IF ${rc}!=0 Fail
Log ${out} console=yes
Remove File ${file_path}cs_apply.yaml
Wait for Catalog To Be Ready catalog_name=rhoai-catalog-dev
Copy File source=${file_path}operatorgroup_template.yaml destination=${file_path}operatorgroup_apply.yaml
Run sed -i 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}operatorgroup_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}operatorgroup_apply.yaml
${rc} ${out} = Run And Return Rc And Output oc apply -f ${file_path}operatorgroup_apply.yaml
IF ${rc}!=0 Fail
Log ${out} console=yes
Remove File ${file_path}operatorgroup_apply.yaml
Copy File source=${file_path}subscription_template.yaml destination=${file_path}subscription_apply.yaml # robocop: disable
Run sed -i 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}subscription_apply.yaml
Run sed -i 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}subscription_apply.yaml
Run sed -i 's/<CS_NAME>/rhoai-catalog-dev/' ${file_path}subscription_apply.yaml
Run sed -i 's/<CS_NAMESPACE>/openshift-marketplace/' ${file_path}subscription_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}subscription_apply.yaml
Run sed -i'' -e 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}subscription_apply.yaml
Run sed -i'' -e 's/<CS_NAME>/rhoai-catalog-dev/' ${file_path}subscription_apply.yaml
Run sed -i'' -e 's/<CS_NAMESPACE>/openshift-marketplace/' ${file_path}subscription_apply.yaml
${rc} ${out} = Run And Return Rc And Output oc apply -f ${file_path}subscription_apply.yaml
IF ${rc}!=0 Fail
Log ${out} console=yes
Expand Down
Loading

0 comments on commit 77b8d09

Please sign in to comment.