Simon Jakobi pushed to branch wip/sjakobi/ci-cabal-update-retry at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • .gitlab/ci.sh
    ... ... @@ -236,12 +236,25 @@ function set_toolchain_paths() {
    236 236
       fi
    
    237 237
     }
    
    238 238
     
    
    239
    -function cabal_update() {
    
    239
    +function cabal_update_once() {
    
    240 240
       # In principle -w shouldn't be necessary here but with
    
    241 241
       # cabal-install 3.8.1.0 it is, due to cabal#8447.
    
    242 242
       run "$CABAL" update -w "$GHC" "hackage.haskell.org,${HACKAGE_INDEX_STATE}"
    
    243 243
     }
    
    244 244
     
    
    245
    +function cabal_update() {
    
    246
    +  local delay
    
    247
    +  for delay in 60 120; do
    
    248
    +    cabal_update_once && return
    
    249
    +    info "Retrying cabal update in $delay seconds"
    
    250
    +    sleep "$delay"
    
    251
    +  done
    
    252
    +  cabal_update_once && return
    
    253
    +
    
    254
    +  [ -f "$CABAL_DIR/packages/hackage.haskell.org/01-index.tar" ] || return 1
    
    255
    +  warn "cabal update failed, continuing with the existing package index"
    
    256
    +}
    
    257
    +
    
    245 258
     
    
    246 259
     # Extract GHC toolchain
    
    247 260
     function setup() {