Skip to content
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

chore: move all GHAs to ubuntu-22.04 #29447

Merged
merged 1 commit into from
Jul 1, 2024
Merged

chore: move all GHAs to ubuntu-22.04 #29447

merged 1 commit into from
Jul 1, 2024

Conversation

mistercrunch
Copy link
Member

GHA doesn't really offer a great way to make this DRY, but that doesn't mean we can't be consistent and deterministic. Ideally we'd set our preferred ubuntu version centrally and change it all at once, but it's really not hard to mass update this.

I got GPT to write a quick script to replace in files for reference:

import os

def replace_strings_in_file(file_path, old_string, new_string):
    with open(file_path, 'r') as file:
        content = file.read()

    content = content.replace(old_string, new_string)

    with open(file_path, 'w') as file:
        file.write(content)

def update_github_workflows(directory='.github/workflows', old_string1='ubuntu-20.04', old_string2='ubuntu-latest', new_string='ubuntu-22.04'):
    for subdir, _, files in os.walk(directory):
        for file in files:
            file_path = os.path.join(subdir, file)
            if file_path.endswith('.yml') or file_path.endswith('.yaml'):
                replace_strings_in_file(file_path, old_string1, new_string)
                replace_strings_in_file(file_path, old_string2, new_string)
                print(f"Updated {file_path}")

if __name__ == "__main__":
    update_github_workflows()

GHA doesn't really offer a great way to make this DRY, but that doesn't mean we can't be consistent and deterministic. Ideally we'd set our preferred ubuntu version centrally and change it all at once, but it's really not hard to mass update this.

I got GPT to write a quick script to replace in files for reference:

```python
import os

def replace_strings_in_file(file_path, old_string, new_string):
    with open(file_path, 'r') as file:
        content = file.read()

    content = content.replace(old_string, new_string)

    with open(file_path, 'w') as file:
        file.write(content)

def update_github_workflows(directory='.github/workflows', old_string1='ubuntu-20.04', old_string2='ubuntu-latest', new_string='ubuntu-22.04'):
    for subdir, _, files in os.walk(directory):
        for file in files:
            file_path = os.path.join(subdir, file)
            if file_path.endswith('.yml') or file_path.endswith('.yaml'):
                replace_strings_in_file(file_path, old_string1, new_string)
                replace_strings_in_file(file_path, old_string2, new_string)
                print(f"Updated {file_path}")

if __name__ == "__main__":
    update_github_workflows()
```
@github-actions github-actions bot added the github_actions Pull requests that update GitHub Actions code label Jul 1, 2024
@rusackas rusackas merged commit 446a3b2 into master Jul 1, 2024
34 of 35 checks passed
@rusackas rusackas deleted the bump_ubuntu branch July 1, 2024 20:19
eschutho pushed a commit that referenced this pull request Jul 24, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels github_actions Pull requests that update GitHub Actions code size/L 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants