Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Merge requests
  • !1378

feat: added sizeLimit option when creating new jobs. issue #1357

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/joshterrill/develop into develop Jul 09, 2019
  • Overview 21
  • Commits 2
  • Pipelines 0
  • Changes 4

Created by: joshterrill

This is my first PR for this repo, I thought this issue would be a good one to get started on. This resolves issue #1357 and adds an optional parameter for sending through a sizeLimit parameter on opts when creating a job. If the data you're sending through is larger than the sizeLimit set, an exception is thrown.

A couple of notes:

  1. I added a dependency called bytes which is a small dependency which allows a user to type a "human readable" sizeLimit such as 1b, 1mb, 1gb, etc. instead of having to convert everything to bytes themselves. I also added a utility function so that a user can either set the limit as a number in bytes, or the human readable format. If you don't want this other dependency there, let me know and I can make it so that it'll just take the number in bytes that a user types in.

  2. I implemented a utility function that I saw on this stack overflow post that describes how to count the size of strings, which also include non-ascii characters. Just to be safe, and to support other character encodings, I use this method to calculate the size.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/joshterrill/develop