8000 Update credential scripts to use default repository context for GitHu… · azure-javaee/weblogic-azure@102482c · GitHub
[go: up one dir, main page]

Skip to content

Commit 102482c

Browse files
authored
Update credential scripts to use default repository context for GitHub CLI commands (oracle#343)
* Update credential scripts to use default repository context for GitHub CLI commands * fix: change 'remove' to 'delete' for GitHub CLI secret teardown
1 parent 930776f commit 102482c

7 files changed

+13
-10
lines changed

.github/resource/azure-credential-setup-wls-aks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SP_ID=$( az ad sp list --display-name $SERVICE_PRINCIPAL_NAME_WLS_AKS --query \[
1414
az role assignment create --assignee ${SP_ID} --scope="/subscriptions/${SUBSCRIPTION_ID}" --role "User Access Administrator"
1515

1616
## Set the Azure Credentials as a secret in the repository
17-
gh secret set "AZURE_CREDENTIALS" -b"${AZURE_CREDENTIALS}"
18-
gh variable set "SERVICE_PRINCIPAL_NAME_WLS_AKS" -b"${SERVICE_PRINCIPAL_NAME_WLS_AKS}"
17+
gh secret --repo $(gh repo set-default --view) set "AZURE_CREDENTIALS" -b"${AZURE_CREDENTIALS}"
18+
gh variable --repo $(gh repo set-default --view) set "SERVICE_PRINCIPAL_NAME_WLS_AKS" -b"${SERVICE_PRINCIPAL_NAME_WLS_AKS}"
1919

2020
echo "Execute azure-credential-setup.sh - End--------------------------------------------"

.github/resource/azure-credential-setup-wls-vm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SERVICE_PRINCIPAL=$(az ad sp create-for-rbac --name ${SERVICE_PRINCIPAL_NAME_WLS
1313
AZURE_CREDENTIALS=$(echo $SERVICE_PRINCIPAL | base64 -d)
1414

1515
## Set the Azure Credentials as a secret in the repository
16-
gh secret set "AZURE_CREDENTIALS" -b"${AZURE_CREDENTIALS}"
17-
gh variable set "SERVICE_PRINCIPAL_NAME_WLS_VM" -b"${SERVICE_PRINCIPAL_NAME_WLS_VM}"
16+
gh secret --repo $(gh repo set-default --view) set "AZURE_CREDENTIALS" -b"${AZURE_CREDENTIALS}"
17+
gh variable --repo $(gh repo set-default --view) set "SERVICE_PRINCIPAL_NAME_WLS_VM" -b"${SERVICE_PRINCIPAL_NAME_WLS_VM}"
1818

1919
echo "Execute azure-credential-setup.sh - End--------------------------------------------"

.github/resource/azure-credential-teardown-wls-aks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -Eeuo pipefail
44

55
echo "Execute azure-credential-teardown.sh - Start------------------------------------------"
66

7-
gh secret delete "AZURE_CREDENTIALS"
8-
SERVICE_PRINCIPAL_NAME_WLS_AKS=$(gh variable get "SERVICE_PRINCIPAL_NAME_WLS_AKS")
7+
gh secret --repo $(gh repo set-default --view) delete "AZURE_CREDENTIALS"
8+
SERVICE_PRINCIPAL_NAME_WLS_AKS=$(gh variable --repo $(gh repo set-default --view) get "SERVICE_PRINCIPAL_NAME_WLS_AKS")
99
az ad sp delete --id $(az ad sp list --display-name $SERVICE_PRINCIPAL_NAME_WLS_AKS --query "[].appId" -o tsv| tr -d '\r\n')
1010

1111
echo "Execute azure-credential-teardown.sh - End--------------------------------------------"

.github/resource/azure-credential-teardown-wls-vm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -Eeuo pipefail
44

55
echo "Execute azure-credential-teardown.sh - Start------------------------------------------"
66

7-
gh secret delete "AZURE_CREDENTIALS"
8-
SERVICE_PRINCIPAL_NAME_WLS_VM=$(gh variable get "SERVICE_PRINCIPAL_NAME_WLS_VM")
7+
gh secret --repo $(gh repo set-default --view) delete "AZURE_CREDENTIALS"
8+
SERVICE_PRINCIPAL_NAME_WLS_VM=$(gh variable --repo $(gh repo set-default --view) get "SERVICE_PRINCIPAL_NAME_WLS_VM")
99
az ad sp delete --id $(az ad sp list --display-name $SERVICE_PRINCIPAL_NAME_WLS_VM --query "[].appId" -o tsv| tr -d '\r\n')
1010

1111
echo "Execute azure-credential-teardown.sh - End--------------------------------------------"

.github/resource/credentials-params-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ set_values() {
4040
yq eval -o=json '.[]' "$param_file" | jq -c '.' | while read -r line; do
4141
name=$(echo "$line" | jq -r '.name')
4242
value=$(echo "$line" | jq -r '.value')
43-
gh secret set "$name" -b"${value}"
43+
gh secret --repo $(gh repo set-default --view) set "$name" -b"${value}"
4444
done
4545
}
4646

.github/resource/credentials-params-teardown.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "teardown-credentials.sh - Start"
77
yq eval -o=json '.[]' "$param_file" | jq -c '.' | while read -r line; do
88
name=$(echo "$line" | jq -r '.name')
99
value=$(echo "$line" | jq -r '.value')
10-
gh secret remove "$name"
10+
gh secret --repo $(gh repo set-default --view) delete "$name"
1111
done
1212

1313
echo "teardown-credentials.sh - Finish"

.github/resource/pre-check.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@ fi
6363
echo "6/6...You are logged in to Azure CLI (az)."
6464

6565
echo "Checking progress completed..."
66+
67+
echo "Select default repository for this project"
68+
gh repo set-default

0 commit comments

Comments
 (0)
0