-
Notifications
You must be signed in to change notification settings - Fork 23
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
Bug: print of IAM policy on gitlab CI not working #49
Comments
UPDATEI have modified #!/bin/bash
set -e
#### Terraform Apply #####
./CI/scripts/pre_terraform.sh
export AWS_CSM_ENABLED=true
export AWS_CSM_PORT=31000
export AWS_CSM_HOST=127.0.0.1
cd infrastructure/aws/
(iamlive --output-file './policy.json' > /dev/null &)
terraform init
terraform workspace select $1 || terraform workspace new $1
terraform apply $2
pkill iamlive
sleep 1
echo ""
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -e "${GREEN}Files found:${NC}"
ls
echo -e "${GREEN}PERMISSIONS USED:${NC}"
#cat ./policy.json
cd ../..
########################### in order just to print the found files and not cat the policy.json file. It has been correctly created:
|
Update 2This is very interesting... it seems that sometimes, policy.json file is created, sometimes it is not. I am not sure why this happens... |
I was not able to reproduce this issue, but I think it might be related to the fact that IAM live takes some time to write the policy file after its process is killed. What the current code does to address this, is to sleep for 1 second after killing IAMLive. I guess it might not be enough in some cases (maybe on more complex projects). For a simple project running locally, it usually takes 0.4 seconds to create the file. Could you try running the pipeline with this new apply.sh? If you share your code I can make some tests as well. What this new code does is to wait for the file to be created (up to 60 seconds).
|
Hi guys. I ran rony's CI on gitlab but the policy does not get printed as it should by iamlive. Below is a screenshot of the final logs of the pipeline:
Any help? Many thanks!!!
The text was updated successfully, but these errors were encountered: