Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ciena-devops

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ciena-devops - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.0.2 (2018-03-16)
* Closes [#10](https://github.com/ciena-blueplanet/ciena-devops/issues/10) - Fix bug related to npm registry not always being timely
# 1.0.1 (2018-02-14)

@@ -2,0 +6,0 @@ * Resolved [#11](https://github.com/ciena-blueplanet/ciena-devops/issues/11) - Current approach to retrieving NPM package version information is not practical

2

package.json
{
"name": "ciena-devops",
"version": "1.0.1",
"version": "1.0.2",
"description": "A collection of scripts and configurations used by the Ciena organization in their DevOps",

@@ -5,0 +5,0 @@ "directories": {

@@ -19,4 +19,5 @@ # ciena-devops

## Configuration
### package.json Configuration
### package.json

@@ -33,3 +34,3 @@ A `repository` property needs to added to the _package.json_ file, such as:

### TravisCI Configuration
### TravisCI

@@ -58,7 +59,57 @@ An environment variable needs to be added to the TravisCI configuration at [https://travis-ci.org](https://travis-ci.org) as well as two additions need to be added to the _.travis.yml_ file.

### TeamCity Configuration
### TeamCity
@TODO
#### #1
An environment variable needs to be added to the TeamCity project configuration named `env.tc.slack.ui-platform.incoming.webhook` whose value is set to the url of the incoming webhook integration for the `#ui-platform` channel.
#### #2
The `Setup CI Environment (inherited)` build step needs to be duplicated and modified, with the original build step being set to disabled. Name the new build step: `Setup CI Environment (deviates from inherited by exporting SLACK_INCOMING_WEBHOOK_URL`
The modification that needs to be made is to add
```bash
# Fill in SLACK_INCOMING_WEBHOOK_URL
export SLACK_INCOMING_WEBHOOK_URL="%env.tc.slack.ui-platform.incoming.webhook%"
```
somewhere within the `cat << EOF > ${ENV_DIR}/nenv` section, before the `EOF` entry.
#### #3
A new build step needs to be added to the TeamCity project configuration with the following information:
![TeamCity Build Step](https://user-images.githubusercontent.com/435544/37061103-ffc6d5e2-2157-11e8-9050-d43120c6f0d6.png)
where the contents of the `Custom script` are:
```bash
#!/bin/bash
NAME=frost-ci-image
IMAGE=$(docker images | grep ${NAME} | awk '{print$3}')
CONTAINER=$(docker ps -a | grep $IMAGE | awk '{print$1}')
# Fill in TEAMCITY_PULL_REQUEST
stripped_branch=$(echo "%teamcity.build.branch%" | sed -e "s/\/merge//")
re='^[0-9]+$'
if [[ $stripped_branch =~ $re ]]
then
export TEAMCITY_PULL_REQUEST="$stripped_branch"
else
export TEAMCITY_PULL_REQUEST="false"
fi
if [[ "$TEAMCITY_PULL_REQUEST" = "false" ]]
then
docker exec $CONTAINER nenv npm install -g ciena-devops@^1.0.0 || exit $?
docker exec $CONTAINER nenv /opt/node-envs/%env.node_version%/lib/node_modules/ciena-devops/scripts/slack/incoming-webhooks/send-message.sh || exit $?
fi
```
and set to run after the `Slack Notification (1) (inherited)` step and before the `Cleanup Container (inherited)` step.
## scripts/package-info.sh

@@ -65,0 +116,0 @@

@@ -9,3 +9,4 @@ #!/usr/bin/env node

const whichPackage = process.argv[2]
const whichVersion = process.argv[3]
const packageVersion = process.argv[3]
const whichVersion = process.argv[4]

@@ -16,2 +17,3 @@ /**

* @param {String} whichPackage NPM package to interrogate
* @param {String} packageVersion "version" property value from package.json file
* @param {?String} whichVersion If 'previous' then previous version, otherwise current

@@ -21,13 +23,27 @@ *

*/
async function getVersion(whichPackage, whichVersion) {
async function getVersion(whichPackage, packageVersion, whichVersion) {
const {stdout, stderr} = await exec(`npm show ${whichPackage} versions --json`)
if (!stderr) {
const offset = (whichVersion === 'previous') ? 1 : 0
const versions = JSON.parse(stdout)
const publishedNpmVersion = versions[versions.length-1]
console.log(versions[versions.length - 1 - offset])
let latest
let previous
// NPM registry has latest package version
if (publishedNpmVersion == packageVersion) {
latest = publishedNpmVersion
previous = versions[versions.length-2]
// NPM registry does not have latest package version
} else {
latest = packageVersion
previous = versions[versions.length-1]
}
console.log(whichVersion === 'previous' ? previous : latest)
}
}
getVersion(whichPackage, whichVersion)
getVersion(whichPackage, packageVersion, whichVersion)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc