Skip to content

Commit

Permalink
Merge pull request #226 from UW-Macrostrat/fix-builds
Browse files Browse the repository at this point in the history
Fix continuous integration build settings
  • Loading branch information
davenquinn authored May 26, 2024
2 parents d246a89 + def3403 commit 762e802
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build Development

name: Build image
on:
push:
branches: ["main"]
tags:
- v[0-9]+.[0-9]+.[0-9]+-** # Semver Pre-Release
- v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]+)?$ # regex for semver tags (including prereleases)
pull_request:
branches: [ main ]
branches: [main]

jobs:
docker:
Expand All @@ -22,11 +22,19 @@ jobs:
uses: docker/metadata-action@v4
with:
images: hub.opensciencegrid.org/macrostrat/macrostrat-api
# New: apply the 'latest' tag only to non-prerelease semver tags
tags: |
type=semver,pattern={{version}}
type=raw,value=latest-itb
type=ref,enable=true,prefix=pr-,suffix=-{{date 'YYYYMMDDHHmmss'}},event=pr
type=raw,value=sha-{{sha}}
type=raw,value=latest-itb
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')}}
type=raw,value=latest-itb-{{date 'YYYYMMDDHHmmss'}}
type=ref,event=pr,suffix=-{{date 'YYYYMMDDHHmmss'}}
type=ref,event=branch,suffix=-{{date 'YYYYMMDDHHmmss'}}
type=ref,event=tag,suffix=-{{date 'YYYYMMDDHHmmss'}}
type=semver,pattern={{version}}
type=semver,pattern={{version}}-{{date 'YYYYMMDDHHmmss'}}
flavor: |
latest=false
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -46,3 +54,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
44 changes: 0 additions & 44 deletions .github/workflows/build-prod.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ app.use(bodyParser.json())
app.use(bodyParser.json({ type: "application/vnd.api+json" }))

// Load and prefix all routes with /api and appropriate version
app.use("/api/v1", v1);
app.use("/api/v2", v2);
app.use("/v1", v1);
app.use("/v2", v2);

// If no version specified, fall back to more current
app.use("/api", v2);
app.use("/", v2);

app.set("json spaces", 2);

Expand Down
22 changes: 12 additions & 10 deletions v2/larkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ var mysql = require("mysql"),
const nameMapping = credentials.postgresDatabases ?? {}
const dbName = nameMapping[db] ?? db

const pool = new pg.Pool({
user: credentials.pg.user,
password: credentials.pg.password,
host: credentials.pg.host,
port: credentials.pg.port,
database: dbName
});
const pool = new pg.Pool({connectionString: credentials.pg.connectionString});

pool.connect(function(err, client, done) {
if (err) {
Expand Down Expand Up @@ -162,7 +156,11 @@ var mysql = require("mysql"),


larkin.info = function(req, res, next) {
var formatted = (req.baseUrl + req.route.path).replace("/api/v" + api.version, "").replace("/api", "").replace(/\/$/, "");
var formatted = (req.baseUrl + req.route.path)
.replace("/api/v" + api.version, "")
.replace("/api", "")
.replace(/\/$/, "")
.replace("/v" + api.version, "");
this.defineRoute(formatted, function(definition) {
res.json({
"success": definition
Expand Down Expand Up @@ -197,7 +195,11 @@ var mysql = require("mysql"),
}
});
} else {
var formatted = (req.baseUrl + req.route.path).replace("/api/v" + api.version, "").replace("/api", "").replace(/\/$/, "");
var formatted = (req.baseUrl + req.route.path)
.replace("/api/v" + api.version, "")
.replace("/api", "")
.replace(/\/$/, "")
.replace("/v" + api.version, "");;
this.defineRoute(formatted, function(definition) {
res
.status((code) ? code : 200)
Expand Down Expand Up @@ -508,7 +510,7 @@ var mysql = require("mysql"),
async.parallel({
unitSummary: function(callback) {
// get all units and summarize for columns
http.get("http://localhost:5000/api/v2/units?all&response=long", function(res) {
http.get("http://localhost:5000/v2/units?all&response=long", function(res) {
var body = "";

res.on("data", function(chunk) {
Expand Down

0 comments on commit 762e802

Please sign in to comment.