Magnus pushed to branch wip/mangoiv/improve-nightly-script at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -1307,7 +1307,8 @@ ghcup-metadata-nightly-push:
    1307 1307
         - git config user.name "GHC GitLab CI"
    
    1308 1308
         - git remote add gitlab_origin https://oauth2:$PROJECT_PUSH_TOKEN@gitlab.haskell.org/ghc/ghcup-metadata.git
    
    1309 1309
         - git add .
    
    1310
    -    - git commit -m "Update metadata"
    
    1310
    +    # a metadata nightly run may result in no changes. We reflect that in the commit message.
    
    1311
    +    - git diff --cached --quiet && git commit --allow-empty -m "Updated metadata: no changes" || git commit -m "Update metadata"
    
    1311 1312
         - git push gitlab_origin HEAD:updates
    
    1312 1313
       rules:
    
    1313 1314
         # Only run the update on scheduled nightly pipelines, ie once a day
    

  • .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
    ... ... @@ -352,7 +352,10 @@ def main() -> None:
    352 352
             with open(args.metadata, 'r') as file:
    
    353 353
                 ghcup_metadata = yaml.safe_load(file)
    
    354 354
                 if  args.version in ghcup_metadata['ghcupDownloads']['GHC']:
    
    355
    -                raise RuntimeError("Refusing to override existing version in metadata")
    
    355
    +                # if there are days without a commit, then the nightly metadata
    
    356
    +                # is up to date by default, no need to fail, no need to upload anything
    
    357
    +                print("Refusing to override existing version in metadata, exiting")
    
    358
    +                sys.exit()
    
    356 359
                 setNightlyTags(ghcup_metadata)
    
    357 360
                 ghcup_metadata['ghcupDownloads']['GHC'][args.version] = new_yaml
    
    358 361
                 print(yaml.dump(ghcup_metadata))