<commit_before>resources:
  - name: delete-timer
    type: time
    source:
      start: 20:00 -0000
      stop: 6:00 -0000
      interval: 2h

  - name: bosh-secrets
    type: s3-iam
    source:
      bucket: {{state_bucket}}
      region_name: {{aws_region}}
      versioned_file: bosh-secrets.yml

jobs:
  - name: delete
    serial: true
    plan:
    - get: delete-timer
      trigger: true
    - get: bosh-secrets
    - task: delete-deployment
      config:
        inputs:
        - name: delete-timer
        - name: bosh-secrets
        image: docker:///concourse/bosh-deployment-resource
        run:
          path: sh
          args:
          - -e
          - -c
          - |
            bosh_password=$(awk '$1~/bosh_admin_password/ {print $2}' bosh-secrets/bosh-secrets.yml)
            bosh -n -t https://10.0.0.6:25555 -u admin -p "${bosh_password}" delete deployment {{deploy_env}}<commit_msg>Deterministically delay deletion for between 0-20m<commit_after>resources:
  - name: delete-timer
    type: time
    source:
      start: 20:00 -0000
      stop: 6:00 -0000
      interval: 2h

  - name: bosh-secrets
    type: s3-iam
    source:
      bucket: {{state_bucket}}
      region_name: {{aws_region}}
      versioned_file: bosh-secrets.yml

jobs:
  - name: delete
    serial: true
    plan:
    - get: delete-timer
      trigger: true
    - get: bosh-secrets
    - task: delete-deployment
      config:
        inputs:
        - name: delete-timer
        - name: bosh-secrets
        image: docker:///concourse/bosh-deployment-resource
        run:
          path: sh
          args:
          - -e
          - -c
          # The following sleep monstrosity deterministically sleeps for a
          # period of time between 0-20mins in order to prevent all our
          # deletion jobs running at the same time. See the commit message for
          # how it works.
          - |
            sum=$(echo {{deploy_env}} | md5sum);
            short=${sum:0:15};
            decimal=$((0x$short));
            sleeptime=$((${decimal##-} % 60*20));
            echo "Sleeping for $sleeptime seconds before deletion.."; sleep $sleeptime && 
            bosh_password=$(awk '$1~/bosh_admin_password/ {print $2}' bosh-secrets/bosh-secrets.yml)
            bosh -n -t https://10.0.0.6:25555 -u admin -p "${bosh_password}" delete deployment {{deploy_env}}
{'fraction_non_alphanumeric': 0.1187156738487537, 'fraction_numerical': 0.030840726658217153, 'mean_word_length': 1.835928143712575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2882496', 'n_tokens_mistral': 825, 'n_tokens_neox': 752, 'n_words': 192}