Skip to content

Commit

Permalink
Adds 8ac0n support for publishing an NPM module
Browse files Browse the repository at this point in the history
- 8ac0n integration with publish.sh
- Exports "import-stormpath" and "reset-okta" global commands
- Renames salamander-migration to stormpath-migration

RELATED TO OKTA-123859
RESOLVES OKTA-123446
8ac0n: test

OKTA-123859
<<<Jenkins Check-In of Tested SHA: 281bdae for [email protected]>>>
Artifact: stormpath-migration
  • Loading branch information
rchild-okta authored and jenkins-okta committed Apr 27, 2017
1 parent f5367ed commit 32b3048
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 54 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# salamander-migration
This repo maintains the migration tools and scripts for Salamander customer migration to Okta.

https://oktawiki.atlassian.net/wiki/display/eng/Salamander+Customer+Migrations
# stormpath-migration

## Requirements

Expand Down Expand Up @@ -72,12 +69,12 @@ Here's a concrete example:
### To Install:
```
npm install
$ npm install -g @okta/stormpath-migration
```

### To Run:
```
node migrate.js --stormPathBaseDir /path/to/export/data --oktaBaseUrl https://your-org.okta.com --oktaApiToken 5DSfsl4x@3Slt6
$ import-stormpath --stormPathBaseDir /path/to/export/data --oktaBaseUrl https://your-org.okta.com --oktaApiToken 5DSfsl4x@3Slt6
```

### Required Args
Expand Down
37 changes: 37 additions & 0 deletions bin/migrate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node

const Promise = require('bluebird');
const introspect = require('../premigration/introspect');
const logger = require('../util/logger');
const config = require('../util/config');

const migrateCustomSchema = require('../migrators/migrate-custom-schema');
const migrateAccounts = require('../migrators/migrate-accounts');
const migrateDirectories = require('../migrators/migrate-directories');
const migrateApplications = require('../migrators/migrate-applications');
const migrateGroups = require('../migrators/migrate-groups');
const migrateOrganizations = require('../migrators/migrate-organizations');

logger.setLevel(config.logLevel);
logger.info(`Starting import...`);

async function migrate() {
try {
console.time('migrate');

await introspect();
await migrateCustomSchema();
await migrateAccounts();
await migrateDirectories();
await migrateGroups();
await migrateOrganizations();
await migrateApplications();

logger.header('Done');
console.timeEnd('migrate');
} catch (err) {
logger.error(err);
}
}

migrate();
12 changes: 6 additions & 6 deletions reset.js → bin/reset.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Helper script to reset org state
#!/usr/bin/env node

const rs = require('./util/request-scheduler');
const logger = require('./util/logger');
const config = require('./util/config');
const ConcurrencyPool = require('./util/concurrency-pool');
const ApiError = require('./util/api-error');
const rs = require('../util/request-scheduler');
const logger = require('../util/logger');
const config = require('../util/config');
const ConcurrencyPool = require('../util/concurrency-pool');
const ApiError = require('../util/api-error');

logger.setLevel(config.logLevel);
const pool = new ConcurrencyPool(config.concurrencyLimit);
Expand Down
35 changes: 0 additions & 35 deletions migrate.js

This file was deleted.

17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{
"name": "@okta/salamander-migration",
"version": "1.0.0",
"name": "@okta/stormpath-migration",
"version": "0.1.0",
"description": "Migration tool to import Stormpath data into an Okta tenant",
"main": "migrate.js",
"bin": {
"import-stormpath": "./bin/migrate.js",
"reset-okta": "./bin/reset.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/okta/salamander-migration.git"
"url": "git+https://github.com/okta/stormpath-migration.git"
},
"keywords": [
"salamander"
"stormpath", "okta"
],
"bugs": {
"url": "https://github.com/okta/salamander-migration/issues"
"url": "https://github.com/okta/stormpath-migration/issues"
},
"homepage": "https://github.com/okta/salamander-migration#readme",
"homepage": "https://github.com/okta/stormpath-migration#readme",
"dependencies": {
"bluebird": "^3.4.7",
"chalk": "^1.1.3",
Expand Down
37 changes: 37 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -vx

source $OKTA_HOME/$REPO/scripts/setup.sh

REGISTRY="https://artifacts.aue1d.saasure.com/artifactory/api/npm/npm-okta"

npm install -g @okta/ci-update-package
npm install -g @okta/ci-pkginfo

export TEST_SUITE_TYPE="build"

if [ -n "$action_branch" ];
then
echo "Publishing from bacon task using branch $action_branch"
TARGET_BRANCH=$action_branch
else
echo "Publishing from bacon testSuite using branch $BRANCH"
TARGET_BRANCH=$BRANCH
fi

if ! ci-update-package --branch ${TARGET_BRANCH}; then
echo "ci-update-package failed! Exiting..."
exit $FAILED_SETUP
fi

if ! npm publish --registry ${REGISTRY}; then
echo "npm publish failed! Exiting..."
exit $PUBLISH_ARTIFACTORY_FAILURE
fi

DATALOAD=$(ci-pkginfo -t dataload)
if ! artifactory_curl -X PUT -u ${ARTIFACTORY_CREDS} ${DATALOAD} -v -f; then
echo "artifactory_curl failed! Exiting..."
exit $PUBLISH_ARTIFACTORY_FAILURE
fi

exit $SUCCESS
15 changes: 15 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -vx

cd ${OKTA_HOME}/${REPO}

# Revert the cache-min setting, since the internal cache does not apply to
# these repos (and causes problems in lookups)
npm config set cache-min 10

# Use newer, faster npm
npm install -g [email protected]

if ! npm install; then
echo "npm install failed! Exiting..."
exit ${FAILED_SETUP}
fi

0 comments on commit 32b3048

Please sign in to comment.