<commit_before>#cloud-config

---
coreos:
  update:
    reboot-strategy: etcd-lock

  units:
    - name: generate-service-account-key.service
      command: start
      content: |
        [Unit]
        Description=Generate service-account key file
        ConditionFileNotEmpty=!/etc/cfssl/service-account-key.pem
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStartPre=-/usr/bin/mkdir --parents /etc/cfssl
        ExecStartPre=/bin/openssl genrsa -out /etc/cfssl/service-account-key.pem 2048 2>/dev/null
        ExecStart=/usr/bin/rkt run \
          --net=host \
          --trust-keys-from-https \
          --volume=dns,kind=host,source=/etc/resolv.conf,readOnly=true --mount volume=dns,target=/etc/resolv.conf \
          --volume=ssl,kind=host,source=/etc/cfssl,readOnly=true --mount=volume=ssl,target=/etc/cfssl \
          quay.io/coreos/awscli -- aws s3 cp /etc/cfssl/service-account-key.pem s3://${ s3-bucket }/

    - name: download-cfssl.service
      command: start
      content: |
        [Unit]
        Description=Download cfssl
        ConditionFileNotEmpty=!/opt/bin/cfssl
        ConditionFileNotEmpty=!/opt/bin/cfssljson
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStartPre=/usr/bin/mkdir --parents /opt/bin
        ExecStartPre=/usr/bin/curl -L -o /opt/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
        ExecStartPre=/usr/bin/curl -L -o /opt/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
        ExecStart=/usr/bin/chmod +x /opt/bin/cfssl /opt/bin/cfssljson

    - name: generate-rootca.service
      command: start
      content: |
        [Unit]
        ConditionFileIsExecutable=/opt/bin/cfssl
        ConditionFileIsExecutable=/opt/bin/cfssljson
        ConditionFileNotEmpty=!/etc/cfssl/ca.pem
        Description=Generate rootca and save to s3
        [Service]
        After=download-cfssl.service
        Type=oneshot
        RemainAfterExit=yes
        WorkingDirectory=/etc/cfssl
        ExecStartPre=/usr/bin/mkdir --parents /etc/cfssl
        ExecStartPre=/bin/sh -c "\
          /opt/bin/cfssl gencert -initca ca-csr.json \
          | /opt/bin/cfssljson -bare ca -"
        ExecStart=/usr/bin/rkt run \
          --net=host \
          --trust-keys-from-https \
          --volume=dns,kind=host,source=/etc/resolv.conf,readOnly=true --mount volume=dns,target=/etc/resolv.conf \
          --volume=ssl,kind=host,source=/etc/cfssl,readOnly=true --mount=volume=ssl,target=/etc/cfssl \
          quay.io/coreos/awscli -- aws s3 cp /etc/cfssl/ca.pem s3://${ s3-bucket }/

    - name: cfssl.service
      command: start
      content: |<commit_msg>fixed misplaced ‘after’ in ski cloud-config<commit_after>#cloud-config

---
coreos:
  update:
    reboot-strategy: etcd-lock

  units:
    - name: generate-service-account-key.service
      command: start
      content: |
        [Unit]
        Description=Generate service-account key file
        ConditionFileNotEmpty=!/etc/cfssl/service-account-key.pem
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStartPre=-/usr/bin/mkdir --parents /etc/cfssl
        ExecStartPre=/bin/openssl genrsa -out /etc/cfssl/service-account-key.pem 2048 2>/dev/null
        ExecStart=/usr/bin/rkt run \
          --net=host \
          --trust-keys-from-https \
          --volume=dns,kind=host,source=/etc/resolv.conf,readOnly=true --mount volume=dns,target=/etc/resolv.conf \
          --volume=ssl,kind=host,source=/etc/cfssl,readOnly=true --mount=volume=ssl,target=/etc/cfssl \
          quay.io/coreos/awscli -- aws s3 cp /etc/cfssl/service-account-key.pem s3://${ s3-bucket }/

    - name: download-cfssl.service
      command: start
      content: |
        [Unit]
        Description=Download cfssl
        ConditionFileNotEmpty=!/opt/bin/cfssl
        ConditionFileNotEmpty=!/opt/bin/cfssljson
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStartPre=/usr/bin/mkdir --parents /opt/bin
        ExecStartPre=/usr/bin/curl -L -o /opt/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
        ExecStartPre=/usr/bin/curl -L -o /opt/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
        ExecStart=/usr/bin/chmod +x /opt/bin/cfssl /opt/bin/cfssljson

    - name: generate-rootca.service
      command: start
      content: |
        [Unit]
        After=download-cfssl.service
        ConditionFileIsExecutable=/opt/bin/cfssl
        ConditionFileIsExecutable=/opt/bin/cfssljson
        ConditionFileNotEmpty=!/etc/cfssl/ca.pem
        Description=Generate rootca and save to s3
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        WorkingDirectory=/etc/cfssl
        ExecStartPre=/usr/bin/mkdir --parents /etc/cfssl
        ExecStartPre=/bin/sh -c "\
          /opt/bin/cfssl gencert -initca ca-csr.json \
          | /opt/bin/cfssljson -bare ca -"
        ExecStart=/usr/bin/rkt run \
          --net=host \
          --trust-keys-from-https \
          --volume=dns,kind=host,source=/etc/resolv.conf,readOnly=true --mount volume=dns,target=/etc/resolv.conf \
          --volume=ssl,kind=host,source=/etc/cfssl,readOnly=true --mount=volume=ssl,target=/etc/cfssl \
          quay.io/coreos/awscli -- aws s3 cp /etc/cfssl/ca.pem s3://${ s3-bucket }/

    - name: cfssl.service
      command: start
      content: |
{'fraction_non_alphanumeric': 0.13289962825278812, 'fraction_numerical': 0.007434944237918215, 'mean_word_length': 2.1708898055391868, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1526760', 'n_tokens_mistral': 1896, 'n_tokens_neox': 1797, 'n_words': 261}