Compare commits

..

2 Commits

Author SHA1 Message Date
Akshay Jagadish
114f2d79b1 WIFI-845: Support Kubernetes Deployment Versioning, changes 2020-10-02 14:10:16 -04:00
Akshay Jagadish
295289b881 WIFI-845: Support Kubernetes Deployment Versioning 2020-10-02 13:58:55 -04:00
5 changed files with 30 additions and 92 deletions

View File

@@ -5,7 +5,10 @@ on:
# Publish `master` as Docker `latest` image.
branches:
- master
- 'release/**'
schedule:
# runs at cronjob at 5AM
- cron: '00 09 * * *'
# Publish `v1.2.3` tags as releases.
tags:
@@ -14,10 +17,6 @@ on:
# Run tests for any PRs.
pull_request:
schedule:
# runs nightly build at 5AM
- cron: '00 09 * * *'
env:
IMAGE_NAME: wlan-cloud-graphql-gw
DOCKER_REPO: tip-tip-wlan-cloud-docker-repo.jfrog.io
@@ -44,35 +43,19 @@ jobs:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'schedule'
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.GH_AUTOMATION_KEY }}
- name: Adding property file with component version and commit hash
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Create a release snapshot if we are on release branch
[[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=1.0.0-SNAPSHOT
TIMESTAMP=$(date +'%Y-%m-%d')
echo date=$TIMESTAMP > commit.properties
echo commitId=$GITHUB_SHA >> commit.properties
echo projectVersion=$VERSION>> commit.properties
- name: Build image
run: docker build . --file Dockerfile --tag image
- name: Set current date as env variable
run: echo "::set-env name=TIMESTAMP::$(date +'%Y-%m-%d')"
- name: Login to Docker Hub
env:
DOCKER_PASSWORD: ${{ secrets.REPO_PASSWORD }}
@@ -82,8 +65,7 @@ jobs:
- name: Push image
run: |
IMAGE_ID=$DOCKER_REPO/$IMAGE_NAME
TIMESTAMP=$(date +'%Y-%m-%d')
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
@@ -93,18 +75,14 @@ jobs:
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Create a release snapshot if we are on release branch
[[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=1.0.0-SNAPSHOT
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo TIMESTAMP=$TIMESTAMP
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag image $IMAGE_ID:$VERSION-$TIMESTAMP
docker push $IMAGE_ID:$VERSION-$TIMESTAMP

View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-graphql-apollo",
"version": "0.4.1",
"version": "0.3.0",
"description": "",
"main": "index.js",
"dependencies": {

View File

@@ -169,17 +169,6 @@ export class API extends RESTDataSource {
`portal/equipmentGateway/requestFirmwareUpdate?equipmentId=${equipmentId}&firmwareVersionId=${firmwareVersionId}`
);
}
async requestEquipmentSwitchBank(equipmentId) {
return this.post(
`portal/equipmentGateway/requestApSwitchSoftwareBank?equipmentId=${equipmentId}`
);
}
async requestEquipmentReboot(equipmentId) {
return this.post(`portal/equipmentGateway/requestApReboot?equipmentId=${equipmentId}`);
}
async requestEquipmentFactoryReset(equipmentId) {
return this.post(`portal/equipmentGateway/requestApFactoryReset?equipmentId=${equipmentId}`);
}
async getEquipmentStatus(customerId, equipmentIds, statusDataTypes) {
return this.get('portal/status/forEquipmentWithFilter', {
@@ -224,11 +213,17 @@ export class API extends RESTDataSource {
});
}
async getAllProfiles({ customerId, cursor, limit, type, context }) {
return this.get('portal/profile/forCustomer', {
const result = await this.get('portal/profile/forCustomer', {
customerId,
...(type && { profileType: type }),
paginationContext: buildPaginationContext(cursor, limit, context),
});
if (type && result.items) {
result.items = result.items.filter((i) => i.profileType === type);
return result;
}
return result;
}
async getProfilesById(profileIdSet) {
return this.get('portal/profile/inSet', {

View File

@@ -155,10 +155,6 @@ const resolvers = {
) => {
return dataSources.api.getAllStatus(customerId, statusDataTypes, cursor, limit, context);
},
getApiUrl: async (_, {}, { dataSources }) => {
return dataSources.api.baseURL;
},
},
Mutation: {
authenticateUser: async (_, { email, password }, { dataSources }) => {
@@ -168,19 +164,19 @@ const resolvers = {
return dataSources.api.updateToken(refreshToken);
},
createUser: async (_, { username, password, roles, customerId }, { dataSources }) => {
return dataSources.api.createUser({ username, password, roles, customerId });
createUser: async (_, { username, password, role, customerId }, { dataSources }) => {
return dataSources.api.createUser({ username, password, role, customerId });
},
updateUser: async (
_,
{ id, username, password, roles, customerId, lastModifiedTimestamp },
{ id, username, password, role, customerId, lastModifiedTimestamp },
{ dataSources }
) => {
return dataSources.api.updateUser({
id,
username,
password,
roles,
role,
customerId,
lastModifiedTimestamp,
});
@@ -238,7 +234,6 @@ const resolvers = {
profileId,
locationId,
name,
baseMacAddress,
latitude,
longitude,
serial,
@@ -255,7 +250,6 @@ const resolvers = {
profileId,
locationId,
name,
baseMacAddress: { addressAsString: baseMacAddress },
latitude,
longitude,
serial,
@@ -272,15 +266,6 @@ const resolvers = {
updateEquipmentFirmware: async (_, { equipmentId, firmwareVersionId }, { dataSources }) => {
return dataSources.api.updateEquipmentFirmware(equipmentId, firmwareVersionId);
},
requestEquipmentSwitchBank: async (_, { equipmentId }, { dataSources }) => {
return dataSources.api.requestEquipmentSwitchBank(equipmentId);
},
requestEquipmentReboot: async (_, { equipmentId }, { dataSources }) => {
return dataSources.api.requestEquipmentReboot(equipmentId);
},
requestEquipmentFactoryReset: async (_, { equipmentId }, { dataSources }) => {
return dataSources.api.requestEquipmentFactoryReset(equipmentId);
},
createProfile: async (
_,
@@ -380,16 +365,6 @@ const resolvers = {
},
},
Equipment: {
baseMacAddress: ({ baseMacAddress }) => baseMacAddress && baseMacAddress.addressAsString,
manufacturer: ({ baseMacAddress }, args, { dataSources }) => {
return (
baseMacAddress &&
baseMacAddress.addressAsString &&
dataSources.api.getOuiLookup(
baseMacAddress.addressAsString.replace(/[:-]/g, '').substring(0, 6)
)
);
},
profile: ({ profileId }, args, { dataSources }) => {
return dataSources.api.getProfile(profileId);
},
@@ -462,7 +437,7 @@ const resolvers = {
reportedMacAddr &&
reportedMacAddr.addressAsString &&
dataSources.api.getOuiLookup(
reportedMacAddr.addressAsString.replace(/[:-]/g, '').substring(0, 6)
reportedMacAddr.addressAsString.replace(/:/g, '').substring(0, 6)
)
);
},
@@ -526,9 +501,7 @@ const resolvers = {
return (
macAddress &&
macAddress.addressAsString &&
dataSources.api.getOuiLookup(
macAddress.addressAsString.replace(/[:-]/g, '').substring(0, 6)
)
dataSources.api.getOuiLookup(macAddress.addressAsString.replace(/:/g, '').substring(0, 6))
);
},
equipment: ({ equipmentId }, args, { dataSources }) => {

View File

@@ -7,8 +7,6 @@ const typeDefs = gql`
scalar JSONObject
type Query {
getApiUrl: String
getUser(id: ID!): User
getAllUsers(customerId: ID!, cursor: String, limit: Int, context: JSONObject): UserPagination
@@ -116,7 +114,7 @@ const typeDefs = gql`
id: ID!
username: String!
password: String
roles: [String]
role: String!
customerId: ID!
lastModifiedTimestamp: String
}
@@ -159,8 +157,6 @@ const typeDefs = gql`
profileId: ID!
locationId: ID!
name: String!
baseMacAddress: String
manufacturer: String
latitude: String
longitude: String
serial: String
@@ -352,12 +348,12 @@ const typeDefs = gql`
authenticateUser(email: String!, password: String!): Token
updateToken(refreshToken: String!): Token
createUser(username: String!, password: String!, roles: [String], customerId: ID!): User
createUser(username: String!, password: String!, role: String!, customerId: ID!): User
updateUser(
id: ID!
username: String!
password: String!
roles: [String]
role: String!
customerId: ID!
lastModifiedTimestamp: String
): User
@@ -399,7 +395,6 @@ const typeDefs = gql`
profileId: ID!
locationId: ID!
name: String!
baseMacAddress: String
latitude: String
longitude: String
serial: String
@@ -409,9 +404,6 @@ const typeDefs = gql`
updateEquipmentBulk(items: [EquipmentRrmUpdate]): GenericResponse
deleteEquipment(id: ID!): Equipment
updateEquipmentFirmware(equipmentId: ID, firmwareVersionId: ID): GenericResponse
requestEquipmentSwitchBank(equipmentId: ID): GenericResponse
requestEquipmentReboot(equipmentId: ID): GenericResponse
requestEquipmentFactoryReset(equipmentId: ID): GenericResponse
createProfile(
profileType: String!