Git Product home page Git Product logo

buildscript's Introduction

< cdnjs >

The #1 free and open source CDN built to make life easier for developers.


Robots only MIT License Discussions

GitHub Sponsors Open Collective Patreon


Table of Contents

Introduction

This is the robot-only repository for cdnjs, where all the library assets that are hosted on cdnjs are stored. For the JSON files that control the libraries we host, please see the "human" cdnjs/packages repository.

Other Repositories

For the JSON files controlling the libraries we host on cdnjs, please take a look at the "human" cdnjs/packages repository.

For our website, please refer to the cdnjs/static-website repository.

For the cdnjs API, please refer to the cdnjs/api-server repository.

For the full cdnjs branding and brand-related assets/guidelines, please see the cdnjs/brand repository.

For our monthly CDN stats and usage reports, check out the cdnjs/cf-stats repository.

You can find all our repositories at github.com/cdnjs!

Contributing

As this repository is now considered robot-only, pull requests are no longer accepted for this repository. If you are looking to contribute to cdnjs, please take a look at the cdnjs/packages repository or any of our other open-source repositories on GitHub!

Sponsors

cdnjs wouldn't be the success that it is today without our sponsors' kind support. These companies currently support cdnjs:

If you are interested in becoming a sponsor, please feel free to contact us!

License

Each library is released under its own license. This cdnjs repository is published under MIT license.

buildscript's People

Contributors

gruselhaus avatar peterdavehello avatar robocdnjs avatar xtuc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buildscript's Issues

Debug level

Can print more detail messages for debug.
(also in log)

Support nvm

I wonder some build failed on my new machine is because there is no system wide nodejs and npm, should support nvm.

separate log() function

Currentlly, logs are handled by each functions, like output()/run(), that's not maintainable, should separate it out.

Command retry

Should retry if command failed, especially the commands need networking.

timelimit exit status can not be catched

function run()
{
echo "`date` [command] $@" >> $logPath/$logFile
local isBuiltIn=false
type $1 &> /dev/null
if [ $? -eq 0 ]; then
local temp="`type $1 | head -n 1`"
if [ "$temp" = "$1 is a shell builtin" ]; then
isBuiltIn=true
fi
fi
if [ "$isBuiltIn" = "false" ]; then
nice -n $nice timelimit -q -s 9 -t $((timeout - 2)) -T $timeout "$@"
local exitStatus=$?
if [ $exitStatus -eq 137 ]; then
error "Got timeout($timeout sec) while running command: '$@'"
elif [ $exitStatus -ne 0 ]; then
error "Got error while running command: '$@'"
fi
else
"$@" || error "Got error while running command: '$@'"
fi
}

    if [ "$isBuiltIn" = "false" ]; then
        nice -n $nice timelimit -q -s 9 -t $((timeout - 2)) -T $timeout "$@"
        local exitStatus=$?
        if [ $exitStatus -eq 137 ]; then
            error "Got timeout($timeout sec) while running command: '$@'"
        elif [ $exitStatus -ne 0 ]; then
            error "Got error while running command: '$@'"
        fi
    else
        "$@" || error "Got error while running command: '$@'"
    fi

if [ "$1" = "build" ]; then
set -e
init
build
fi

if [ "$1" = "build" ]; then
    set -e
    init
    build
fi

bash will catch the error by set -e ...

tmux window title support

The window title will be "bash " by default because this is a bash shellscript project, so it is unrecognized once we are using bash as our shell, there is no difference between this buildScript and an interactive bash, we should set a title for it.

Wrong message/log level

Currenttly, many messages with "Success" are not really a message with success but just designed to use it's color, should change it to "Info" or something else.

command timeout handling

To prevent infinite waiting on a certain command.

We can easily have timeout on GNU/Linux distrobutions, but FreeBSD need version 11 to have it.

Update submodule during build

We have submodule tutorials under new-website, should better do submodule update like:
git submodule update or git submodule update --init during the build to prevent unstaged changes.

It's also possible to update submodule during the process and automatically commit the updates of submodules.

cc @cdnjs/team-cdnjs

Enhance log

  • datetime
  • option to decide cleanup or append the old log
  • custom log file path

Enhance

  • Force rebuild option
  • Force reindex option
  • More error detection and exit when getting error
  • Logs (?)
  • Website repo should has 2-tier update (fetch from local repo as main repo).
  • Gitter webhook
  • Color output

filesystem warm-up

The issue is about why we have so many build-failed issues in a short time, and in series.

Examples:
cdnjs/cdnjs#7139
cdnjs/cdnjs#7140
cdnjs/cdnjs#7141

We have time limit setting here:

https://github.com/cdnjs/buildScript/blob/master/config.sh#L14

timeout=600

https://github.com/cdnjs/buildScript/blob/master/update-website.sh#L82

nice -n $nice timelimit -q -s 9 -t $((timeout - 2)) -T $timeout "$@"

So we have 10 mins for each command by default.

By tracing the log, I found the failed point usually be this line:

https://github.com/cdnjs/buildScript/blob/master/update-website.sh#L110

run git reset --hard

I found that once I reboot my server, almost the all the git commands in cdnjs repo will be very very slow, the hard disk will be noisy for a while, the memory usage increase, it will continue about 15~25 mins, and once it finished, the upcoming commands will be very fast, maybe just few seconds, so I guess linux will cache the recently used files on the filesystem, but once we reboot, the cache had been flushed, the only first git command after booting will be very slow, maybe adding a warm-up command can improve this problem.

Build lock mechanism

Today we got problem on heroku deployment:
cdnjs/cdnjs#5305

This build script successfully detected the unsuccessfully building process and submit an issue for tracking this issue, I was just around my computer and try to trace the problem and pause the cronjob for cdnjs building, in case I am not around, the crontob will continue calling the build process every hour, will cause message/issue flooding until the problem been solved, I think we should provide a mechanism to prevent this problem.

Essential feature(s):

  • Write a error record as a lock when getting error.
  • Detect the lock from the start, skip build if lock exists. (Need manually remove it when problem been fixed.)

Advanced feature(s):

  • Do not skip the following build process, but reply the status on the same issue(need to write down the issue number first)
  • Automatically report and close the issue when the first successful build come up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.