Skip to content

reset CWMS_20 password on subsequent runs. #1066

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

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all 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
9 changes: 7 additions & 2 deletions .github/actions/database-migration-image/entry.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

export CWMS_PASSWORD=`tr -cd '[:alnum:]' < /dev/urandom | fold -w25 | head -n1`
cat > /tmp/create-app-user.sql <<EOF
declare
user_count integer;
Expand All @@ -10,6 +10,11 @@ begin
else
execute immediate 'alter user &1 identified by "&2"';
end if;
-- assign a new CWMS_20 password for new operations
select count(*) into user_count from dba_users where upper(username)='CWMS_20';
if (user_count > 0) then
execute immediate 'alter user cwms_20 identified by "&3"';
end if;
end;
/
EOF
Expand All @@ -20,6 +25,6 @@ EOF

# Create app user first, one of the migration steps is to update the "cwms user" information for that user

sqlplus $BUILDUSER/$BUILDUSER_PASSWORD@$DB_HOST_PORT$DB_NAME @/tmp/create-app-user "$CDA_USERNAME" "$CDA_PASSWORD"
sqlplus $BUILDUSER/$BUILDUSER_PASSWORD@$DB_HOST_PORT$DB_NAME @/tmp/create-app-user "$CDA_USERNAME" "$CDA_PASSWORD" "$CWMS_PASSWORD"

exec $*
Loading