Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ACNA-1375 - updater for runtimes.json for aio app run --local #557

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions bin/openwhisk-standalone-config/get-runtimes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const fetch = require('node-fetch')

const DOCKER_ORG = 'adobeapiplatform'
const DOCKER_REPOS = { // repo-name:kind
'adobe-action-nodejs-v10': 'nodejs:10',
'adobe-action-nodejs-v12': 'nodejs:12',
'adobe-action-nodejs-v14': 'nodejs:14',
'adobe-action-nodejs-v16': 'nodejs:16',
}

const DEFAULT_KIND = 'nodejs:16'

async function main() {
const nodejs = []

for ([repoName, kind] of Object.entries(DOCKER_REPOS)) {
const data = await fetch(`https://registry.hub.docker.com/v2/repositories/${DOCKER_ORG}/${repoName}/tags`)
const json = await data.json()
const defaultKind = (kind === DEFAULT_KIND)? true : undefined

nodejs.push({
kind,
default: defaultKind,
image: {
prefix: DOCKER_ORG,
name: repoName,
tag: json.results[0].name
}
})
}

const output = {
runtimes: {
nodejs
}
}
console.log(JSON.stringify(output, null, 2))
}

main()

24 changes: 16 additions & 8 deletions bin/openwhisk-standalone-config/runtimes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,36 @@
"runtimes": {
"nodejs": [
{
"kind": "nodejs:14",
"default": true,
"kind": "nodejs:10",
"image": {
"prefix": "adobeapiplatform",
"name": "adobe-action-nodejs-v14",
"tag": "3.0.28"
"name": "adobe-action-nodejs-v10",
"tag": "3.0.32"
}
},
{
"kind": "nodejs:12",
"image": {
"prefix": "adobeapiplatform",
"name": "adobe-action-nodejs-v12",
"tag": "3.0.28"
"tag": "3.0.32"
}
},
{
"kind": "nodejs:10",
"kind": "nodejs:14",
"image": {
"prefix": "adobeapiplatform",
"name": "adobe-action-nodejs-v10",
"tag": "3.0.28"
"name": "adobe-action-nodejs-v14",
"tag": "3.0.32"
}
},
{
"kind": "nodejs:16",
"default": true,
"image": {
"prefix": "adobeapiplatform",
"name": "adobe-action-nodejs-v16",
"tag": "3.0.32"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"prepack": "oclif manifest && oclif readme",
"test": "npm run unit-tests && npm run lint",
"unit-tests": "jest -c jest.config.js",
"version": "oclif readme && git add README.md"
"version": "oclif readme && git add README.md",
"update-openwhisk-runtimes": "node bin/openwhisk-standalone-config/get-runtimes.js > bin/openwhisk-standalone-config/runtimes.json"
},
"bin": {
"aio-next": "./bin/run"
Expand Down