Skip to content

Commit f3b4aae

Browse files
committed
reset CWMS_20 password on subsequent runs.
1 parent 1d5b477 commit f3b4aae

File tree

1 file changed

+7
-2
lines changed
  • .github/actions/database-migration-image

1 file changed

+7
-2
lines changed

.github/actions/database-migration-image/entry.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
export CWMS_PASSWORD=`tr -cd '[:alnum:]' < /dev/urandom | fold -w25 | head -n1`
33
cat > /tmp/create-app-user.sql <<EOF
44
declare
55
user_count integer;
@@ -10,6 +10,11 @@ begin
1010
else
1111
execute immediate 'alter user &1 identified by "&2"';
1212
end if;
13+
-- assign a new CWMS_20 password for new operations
14+
select count(*) into user_count from dba_users where upper(username)='CWMS_20';
15+
if (user_count > 0) then
16+
execute immediate 'alter user cwms_20 identified by "&3"';
17+
end if;
1318
end;
1419
/
1520
EOF
@@ -20,6 +25,6 @@ EOF
2025

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

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

2530
exec $*

0 commit comments

Comments
 (0)