Skip to content

Commit

Permalink
fixed the for loop (#736)
Browse files Browse the repository at this point in the history
fixed the for loop
  • Loading branch information
athiruma authored Feb 27, 2024
1 parent 3af340f commit 11967ff
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
14 changes: 7 additions & 7 deletions jenkins/clouds/aws/daily/policies/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
account = ['perf-dept' : "", 'perfscale': "", 'psap': ""]
accounts_list = ['perf-dept' : "", 'perfscale': "", 'psap': ""]
pipeline {
options {
disableConcurrentBuilds()
Expand Down Expand Up @@ -43,12 +43,12 @@ pipeline {
stage('Run Daily Policies') {
steps {
script {
for (int i = 0; i < account.size(); ++i) {
echo "Running for account ${account[i].toUpperCase()}"
withCredentials([string(credentialsId: "${account[i]}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
for (account in accounts_list.keySet() {
echo "Running for account ${account.toUpperCase()}"
withCredentials([string(credentialsId: "${account}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account}"
env.ADMIN_MAIL_LIST = "${accounts_list[account]}"
sh 'python3 jenkins/clouds/aws/daily/policies/run_policies.py'
}
Expand Down
2 changes: 0 additions & 2 deletions jenkins/clouds/aws/daily/policies/azure_policies.py

This file was deleted.

24 changes: 12 additions & 12 deletions jenkins/tenant/aws/ecoeng_02/PolicyJenkinsfileDaily
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ pipeline {
stage('Run Cost Policies') {
steps {
script {
for (int i = 0; i < account.size(); ++i) {
echo "Running for account ${account[i].toUpperCase()}"
withCredentials([string(credentialsId: "${account[i]}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
for (account in accounts_list.keySet()) {
echo "Running for account ${account.toUpperCase()}"
withCredentials([string(credentialsId: "${account}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account}"
sh 'python3 jenkins/tenant/aws/common/run_cost_policies.py'
}
}
Expand All @@ -56,12 +56,12 @@ pipeline {
stage('Run Daily Policies') {
steps {
script {
for (int i = 0; i < account.size(); ++i) {
echo "Running for account ${account[i].toUpperCase()}"
withCredentials([string(credentialsId: "${account[i]}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
for (account in accounts_list.keySet()) {
echo "Running for account ${account.toUpperCase()}"
withCredentials([string(credentialsId: "${account}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account}"
env.ADMIN_MAIL_LIST = "${accounts_list[account]}"
sh 'python3 jenkins/tenant/aws/common/run_policies.py'
}
Expand Down
26 changes: 13 additions & 13 deletions jenkins/tenant/aws/ecoeng_03/PolicyJenkinsfileDaily
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
account = ['coreos-training': "[email protected], [email protected]",
accounts_list = ['coreos-training': "[email protected], [email protected]",
'industry-partners': "",
'special-projects': "",
'edgeinfra': "",
Expand Down Expand Up @@ -46,12 +46,12 @@ pipeline {
stage('Run Cost Policies') {
steps {
script {
for (int i = 0; i < account.size(); ++i) {
echo "Running for account ${account[i].toUpperCase()}"
withCredentials([string(credentialsId: "${account[i]}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
for (account in accounts_list.keySet() ) {
echo "Running for account ${account.toUpperCase()}"
withCredentials([string(credentialsId: "${account}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account}"
sh 'python3 jenkins/tenant/aws/common/run_cost_policies.py'
}
}
Expand All @@ -61,12 +61,12 @@ pipeline {
stage('Run Daily Policies') {
steps {
script {
for (int i = 0; i < account.size(); ++i) {
echo "Running for account ${account[i].toUpperCase()}"
withCredentials([string(credentialsId: "${account[i]}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
for (account in accounts_list.keySet()) {
echo "Running for account ${account.toUpperCase()}"
withCredentials([string(credentialsId: "${account}-aws-access-key-id", variable: 'access_key'),
string(credentialsId: "${account}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account}"
env.ADMIN_MAIL_LIST = "${accounts_list[account]}"
sh 'python3 jenkins/tenant/aws/common/run_policies.py'
}
Expand Down

0 comments on commit 11967ff

Please sign in to comment.