Răsfoiți Sursa

testing de push logic in travis other logic still incomplete

thelamer 5 ani în urmă
părinte
comite
3d44646175
5 a modificat fișierele cu 144 adăugiri și 0 ștergeri
  1. 59 0
      .travis.yml
  2. 28 0
      script/build_release
  3. 16 0
      script/index.html
  4. 36 0
      script/message
  5. 5 0
      script/pre_install

+ 59 - 0
.travis.yml

@@ -0,0 +1,59 @@
+sudo: true
+
+language: bash
+
+services:
+  - docker
+
+env:
+  global:
+    - DEBIAN_FRONTEND="noninteractive"
+
+jobs:
+  include:
+    - stage: development
+      if: branch = development AND tag IS blank AND type != pull_request
+      before_install:
+        - ./script/pre_install
+      script:
+        - ./script/build_release dev
+      after_failure:
+        - ./script/message failure
+      deploy:
+        - provider: s3
+          access_key_id: $AWS_ACCESS_KEY_ID
+          secret_access_key: $AWS_SECRET_ACCESS_KEY
+          bucket: $BUCKET_DEV
+          local_dir: s3out
+          upload-dir: $TRAVIS_COMMIT
+          region: us-west-2
+          skip_cleanup: true
+      after_deploy:
+        - ./script/message dev-push
+    - stage: pull-request
+      if: type = pull_request
+      script:
+        - echo test
+    - stage: release-canidate
+      if: branch = development AND tag IS present AND type != pull_request
+      script:
+        - echo test
+    - stage: release
+      if: branch = master AND type != pull_request
+      script:
+        - echo test
+      deploy:
+        - provider: s3
+          access_key_id: $AWS_ACCESS_KEY_ID
+          secret_access_key: $AWS_SECRET_ACCESS_KEY
+          bucket: $BUCKET_LIVE
+          local_dir: s3out
+          skip_cleanup: true
+        - provider: releases
+          api_key: $GITHUB_TOKEN
+          file_glob: true
+          file: githubout/*
+          skip_cleanup: true
+      after_deploy:
+        - aws configure set preview.cloudfront true
+        - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID_BOOT --paths "/*"

+ 28 - 0
script/build_release

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+TYPE=$1
+
+# Set boot domain
+if [[ "${TYPE}" == "dev" ]]; then
+  BOOT_DOMAIN="${BUCKET_DEV}.s3-us-west-2.amazonaws.com/${TRAVIS_COMMIT}"
+fi
+sed -i \
+  "/^#boot_domain/c\boot_domain: ${BOOT_DOMAIN}" \
+  user_overrides.yml
+
+# Build release
+docker build -t localbuild -f Dockerfile-build .
+docker run --rm -it -v $(pwd):/buildout localbuild
+
+# Generate folder outputs
+mkdir -p s3out
+cp -r buildout/* s3out/
+cp script/index.html s3out/
+mkdir -p githubout
+mv buildout/ipxe/* githubout/
+cd buildout
+rm -Rf ipxe
+tar -czf menus.tar.gz *
+mv menus.tar.gz ../githubout
+cd ..
+

+ 16 - 0
script/index.html

@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Netboot.xyz BootLoaders</title>
+  </head>
+  <body>
+  <a href="ipxe/netboot.xyz.iso">netboot.xyz.iso</a>
+  <a href="ipxe/netboot.xyz-efi.iso">netboot.xyz-efi.iso</a>
+  <a href="ipxe/netboot.xyz.dsk">netboot.xyz.dsk</a>
+  <a href="ipxe/netboot.xyz.usb">netboot.xyz.usb</a>
+  <a href="ipxe/netboot.xyz.lkrn">netboot.xyz.lkrn</a>
+  <a href="ipxe/netboot.xyz.kpxe">netboot.xyz.kpxe</a>
+  <a href="ipxe/netboot.xyz-undionly.kpxe">netboot.xyz-undionly.kpxe</a>
+  <a href="ipxe/netboot.xyz.efi">netboot.xyz.efi</a>
+  </body>
+</html>

+ 36 - 0
script/message

@@ -0,0 +1,36 @@
+#!/bin/bash
+
+TYPE=$1
+
+if [ "${TYPE}" == "dev-push" ]; then
+  BOOT_URL="https://${BUCKET_DEV}.s3-us-west-2.amazonaws.com/${TRAVIS_COMMIT}/index.html"
+fi
+
+# send status to discord
+if [ "${TYPE}" == "failure" ]; then
+  curl -X POST --data \
+  '{
+    "avatar_url": "https://avatars.io/twitter/travisci",
+    "embeds": [
+      {
+        "color": 16711680,
+        "description": "__**Failed to Build**__ \n**Build:**  '${TRAVIS_BUILD_WEB_URL}'\n**External Version:**  '${EXTERNAL_VERSION}'\n**Status:**  Failure\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${TRAVIS_COMMIT}'\n"
+      }
+    ],
+    "username": "Travis CI"
+  }' \
+  ${DISCORD_HOOK_URL}
+else
+  curl -X POST --data \
+  '{
+    "avatar_url": "https://avatars.io/twitter/travisci",
+    "embeds": [
+      {
+        "color": 1681177,
+        "description": "__**Boot Menu Published**__ \n**Files:** '${BOOT_URL}' \n**Build:**  '${TRAVIS_BUILD_WEB_URL}'\n**External Version:**  '${EXTERNAL_VERSION}'\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${TRAVIS_COMMIT}'\n"
+      }
+    ],
+    "username": "Travis CI"
+  }' \
+  ${DISCORD_HOOK_URL}
+fi

+ 5 - 0
script/pre_install

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Install aws cli
+
+pip install awscli tornado