Skip to content

chore: migrate gsutil usage to gcloud storage - #15846

Open
gurusai-voleti wants to merge 5 commits into
google:masterfrom
gurusai-voleti:gsutil_migration_infra_3
Open

chore: migrate gsutil usage to gcloud storage#15846
gurusai-voleti wants to merge 5 commits into
google:masterfrom
gurusai-voleti:gsutil_migration_infra_3

Conversation

@gurusai-voleti

Copy link
Copy Markdown
Contributor

No description provided.

command = ['gcloud', 'storage']
if parallel:
command.append('-m')
pass

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on the point here? If it's just to void the change then could we either leave a comment, perhaps remove the condition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@ViniciustCosta

Copy link
Copy Markdown
Contributor

/gcbrun

@ViniciustCosta ViniciustCosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just noticed that the CiFuzz image does not have gcloud installed.

$ docker run -it --rm --entrypoint /bin/bash gcr.io/oss-fuzz-base/cifuzz-base
root@25078bdb4242:/# gsutil --version
gsutil version: 5.20
root@25078bdb4242:/# gcloud --version
bash: gcloud: command not found
root@25078bdb4242:/# which gcloud
root@25078bdb4242:/#

From previous discussions, it seems that gcloud was making the image larger, which increases the time to pull it during CI. Please, could you fix the base image and check how much larger it would get? We should compare the time it takes in CI to see if the migration is worth it

@ViniciustCosta

Copy link
Copy Markdown
Contributor

I've made some tests using the CiFuzz image. The sizes of the cifuzz-base image before and after adding the the google-cloud-cli package and its dependencies:

  • Before (Without gcloud): ~2.36 GB
  • After (With gcloud via APT): ~3.11 GB

It seems that the size difference is relevant, but it might be negligible on the time it takes to pull the image in a normal CI environment, adding something like 10 seconds to pull the image. We should test with a few projects though

@ViniciustCosta

Copy link
Copy Markdown
Contributor

/gcbrun

apt-get install -y docker-ce-cli
apt-get install -y docker-ce-cli google-cloud-cli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add

    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

when they weren't there before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are cleanup commands to remove temp files if any

# Explicitly remove legacy gsutil and bq CLI binaries
rm -f /usr/bin/gsutil /usr/bin/bq /opt/gcloud/google-cloud-sdk/bin/gsutil /opt/gcloud/google-cloud-sdk/bin/bq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment thread infra/cifuzz/platform_config/gcb.py Outdated
def filestore(self):
"""Returns the filestore used to store persistent data."""
return os.environ.get('FILESTORE', 'gsutil')
return os.environ.get('FILESTORE', 'gcloud storage')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate on the reasoning behind this? Specifically, this is not a command but rather a lookup, so have you validated the semantics/impact here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the exact context, I can keep only gcloud if it used only for lookup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this @DavidKorczynski !

@gurusai-voleti you probably need to either change the directory paths and class from gsutil to gcloud or keep as is. This is used as map to the correct class here: https://github.com/google/oss-fuzz/blob/master/infra/cifuzz/filestore_utils.py#L25

@ViniciustCosta ViniciustCosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we need to test it to check the image pull overhead due to the gcloud SDK.

Comment thread infra/cifuzz/platform_config/gcb.py Outdated
def filestore(self):
"""Returns the filestore used to store persistent data."""
return os.environ.get('FILESTORE', 'gsutil')
return os.environ.get('FILESTORE', 'gcloud storage')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this @DavidKorczynski !

@gurusai-voleti you probably need to either change the directory paths and class from gsutil to gcloud or keep as is. This is used as map to the correct class here: https://github.com/google/oss-fuzz/blob/master/infra/cifuzz/filestore_utils.py#L25

@gurusai-voleti

Copy link
Copy Markdown
Contributor Author

Looks good, but we need to test it to check the image pull overhead due to the gcloud SDK.

reverted to Gsutil only as it works as folder identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants