-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recore to be hardcore, hard core?, literally, i mean we finally have …
…a defined core, not a soft core (#74) * begin core reorg for better v4 alignment * begin core reorg for better v4 alignment part 2 * rework dogfooding logix for new plugin naming * rework dogfooding logix for new plugin naming part 2 * rework dogfooding logix for new plugin naming part 3 * rework dogfooding logix for new plugin naming part 4 * rework dogfooding logix for new plugin naming part 5 * rework dogfooding logix for new plugin naming part 6 * rework dogfooding logix for new plugin naming part 7 * recore1 * Revert "recore1" This reverts commit c298687. * recore2 * recore3 * recore4 * recore5 * recore5 * recore6 * recore7 * recore8 * recore9 * recore10 * recore10 * recore11 * recore12 * recore13 * recore15 * recore16 * recore17 * recore18 * recore19 * recore20 * recore21 * first recore * hardening the core * hardcore1 * hardcore3 * hardcore4 * hardcore5 * hardcore5a * hardcore6 * hardcore7 * hardcore8 * hardcore8b * hardcore8c * hardcore9 * hardcore11 * hardcore12 * hardcore13 * hardcore14 * hardcore15 * hardcore16 * hardcore17 * hardcore18 * hardcore19 * hardcore20 * hardcore21 * hardcore22 * hardcore23 * hardcore24 * hardcore25 * hardcore26 * finalcore?
- Loading branch information
Showing
305 changed files
with
5,097 additions
and
5,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Plugin Tests | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
leia-tests: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
TERM: xterm | ||
GITHUB_PAT: ${{ secrets.PIROG_TOKEN }} | ||
GITHUB_KEY_NAME: "${{ github.sha }}${{ matrix.docker-compose-version }}" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
docker-compose-version: | ||
- "1.29.1" | ||
- "2.21.0" | ||
healthcheck: | ||
- new | ||
lando-version: | ||
- 3-dev | ||
leia-test: | ||
- examples/healthcheck | ||
- examples/networking | ||
- examples/proxy | ||
- examples/scanner | ||
node-version: | ||
- "16" | ||
os: | ||
- ubuntu-22.04 | ||
scanner: | ||
- new | ||
include: | ||
# run legacy scanner checks on dc2 | ||
- docker-compose-version: "2.21.0" | ||
healthcheck: new | ||
node-version: "16" | ||
lando-version: 3-dev | ||
leia-test: examples/scanner | ||
os: ubuntu-22.04 | ||
scanner: legacy | ||
# run legacy healthchecks on dc2 | ||
- docker-compose-version: "2.21.0" | ||
healthcheck: legacy | ||
node-version: "16" | ||
lando-version: 3-dev | ||
leia-test: examples/healthcheck | ||
os: ubuntu-22.04 | ||
scanner: new | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: https://registry.npmjs.org | ||
cache: yarn | ||
- name: Install Yarn dependencies | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
- name: Setup lando ${{ matrix.lando-version }} | ||
uses: lando/setup-lando@v2 | ||
with: | ||
lando-version: ${{ matrix.lando-version }} | ||
config: | | ||
orchestratorVersion=${{ matrix.docker-compose-version }} | ||
telemetry: false | ||
- name: Verify Lando works and we are dogfooding this plugin for tests | ||
run: | | ||
mkdir -p /home/runner/.lando/plugins/@lando | ||
ln -sf /home/runner/work/core/core /home/runner/.lando/plugins/@lando/core | ||
lando --clear | ||
lando config | ||
lando config --path plugins --format json | jq -r '.[] | select(.name == "@lando/core").searchDir' | grep /home/runner/work/core/core || (echo "::error:: Not dogfooding this plugin correctly!" && exit 1) | ||
lando config --path plugins --format json | jq -r '.[] | select(.name == "@lando/networking").searchDir' | grep /home/runner/work/core/core/plugins/networking || (echo "::error:: Not dogfooding this plugin correctly!" && exit 1) | ||
- name: Run Leia Tests | ||
uses: lando/run-leia-action@v2 | ||
env: | ||
LANDO_SCANNER: ${{ matrix.scanner }} | ||
LANDO_HEALTHCHECK: ${{ matrix.new }} | ||
with: | ||
leia-test: "./${{ matrix.leia-test }}/README.md" | ||
cleanup-header: "Destroy tests" | ||
shell: bash | ||
stdin: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
'use strict'; | ||
|
||
// Modules | ||
const _ = require('lodash'); | ||
const path = require('path'); | ||
|
||
const {nanoid} = require('nanoid'); | ||
|
||
// Helper to set the LANDO_LOAD_KEYS var | ||
const getKeys = (keys = true) => { | ||
if (_.isArray(keys)) return keys.join(' '); | ||
return keys.toString(); | ||
}; | ||
|
||
module.exports = async (app, lando) => { | ||
// Compose cache key | ||
app.composeCache = `${app.name}.compose.cache`; | ||
// Tooling cache key | ||
app.toolingCache = `${app.name}.tooling.cache`; | ||
// Build step locl files | ||
app.preLockfile = `${app.name}.build.lock`; | ||
app.postLockfile = `${app.name}.post-build.lock`; | ||
|
||
// Add v4 stuff to the app object | ||
app.v4 = {}; | ||
app.v4._debugShim = require('./utils/debug-shim')(app.log); | ||
app.v4._dir = path.join(lando.config.userConfRoot, 'v4', `${app.name}-${app.id}`); | ||
app.v4.orchestratorVersion = '3.6'; | ||
app.v4.preLockfile = `${app.name}.v4.build.lock`; | ||
app.v4.postLockfile = `${app.name}.v4.build.lock`; | ||
app.v4.services = []; | ||
app.v4.composeCache = `${app.name}.compose.cache`; | ||
|
||
// front load top level networks | ||
app.v4.addNetworks = (data = {}) => { | ||
app.add({ | ||
id: `v4-${nanoid()}`, | ||
info: {}, | ||
data: [{networks: data, version: app.v4.orchestratorVersion}], | ||
}, true); | ||
}; | ||
// front load top level volumes | ||
app.v4.addVolumes = (data = {}) => { | ||
app.add({ | ||
id: `v4-${nanoid()}`, | ||
info: {}, | ||
data: [{volumes: data, version: app.v4.orchestratorVersion}], | ||
}, true); | ||
}; | ||
|
||
// load in and parse recipes | ||
app.events.on('pre-init', 4, async () => await require('./hooks/app-add-recipes')(app, lando)); | ||
|
||
// load in and parse v3 services | ||
app.events.on('pre-init', async () => await require('./hooks/app-add-v3-services')(app, lando)); | ||
|
||
// load in and parse v4 services | ||
app.events.on('pre-init', async () => await require('./hooks/app-add-v4-services')(app, lando)); | ||
|
||
// run v3 build steps | ||
app.events.on('post-init', async () => await require('./hooks/app-run-v3-build-steps')(app, lando)); | ||
|
||
// run v4 build steps | ||
app.events.on('post-init', async () => await require('./hooks/app-run-v4-build-steps')(app, lando)); | ||
|
||
// Add localhost info to our containers if they are up | ||
app.events.on('post-init', async () => await require('./hooks/app-find-localhosts')(app, lando)); | ||
|
||
// refresh all out v3 certs | ||
app.events.on('post-init', async () => await require('./hooks/app-refresh-v3-certs')(app, lando)); | ||
|
||
// Run a secondary user perm sweep on services that cannot run as root eg mysql | ||
app.events.on('post-init', async () => await require('./hooks/app-run-v3-secondary-sweep')(app, lando)); | ||
|
||
// Assess our key situation so we can warn users who may have too many | ||
app.events.on('post-init', async () => await require('./hooks/app-check-ssh-keys')(app, lando)); | ||
|
||
// Add tooling if applicable | ||
app.events.on('post-init', async () => await require('./hooks/app-add-tooling')(app, lando)); | ||
|
||
// Collect info so we can inject LANDO_INFO | ||
// @NOTE: this is not currently the full lando info because a lot of it requires the app to be on | ||
app.events.on('post-init', 10, async () => await require('./hooks/app-set-lando-info')(app, lando)); | ||
|
||
// Analyze an apps compose files so we can set the default bind addres correctly | ||
// @TODO: i feel like there has to be a better way to do this than this mega loop right? | ||
app.events.on('post-init', 9999, async () => await require('./hooks/app-set-bind-address')(app, lando)); | ||
|
||
// override the ssh tooling command with a good default | ||
app.events.on('ready', 1, async () => await require('./hooks/app-override-ssh-defaults')(app, lando)); | ||
|
||
// Discover portforward true info | ||
app.events.on('ready', async () => await require('./hooks/app-set-portforwards')(app, lando)); | ||
|
||
// set tooling compose cache | ||
app.events.on('ready', async () => await require('./hooks/app-set-compose-cache')(app, lando)); | ||
|
||
// v4 parts of the app are ready | ||
app.events.on('ready', 6, async () => await require('./hooks/app-v4-ready')(app, lando)); | ||
|
||
// Save a compose cache every time the app is ready, we have to duplicate this for v4 because we modify the | ||
// composeData after the v3 app.ready event | ||
app.events.on('ready-v4', async () => await require('./hooks/app-set-v4-compose-cache')(app, lando)); | ||
|
||
// Otherwise set on rebuilds | ||
// NOTE: We set this pre-rebuild because post-rebuild runs after post-start because you would need to | ||
// do two rebuilds to remove the warning since appWarning is already set by the time we get here. | ||
// Running pre-rebuild ensures the warning goes away but concedes a possible warning tradeoff between | ||
// this and a build step failure | ||
app.events.on('pre-rebuild', async () => await require('./hooks/app-update-built-against')(app, lando)); | ||
|
||
// Determine pullable and locally built images | ||
app.events.on('pre-rebuild', async () => await require('./hooks/app-set-pullables')(app, lando)); | ||
|
||
// we need to temporarily set app.compose to be V3 only and then restore it post-rebuild | ||
// i really wish thre was a better way to do this but alas i do not think there is | ||
app.events.on('pre-rebuild', 10, async () => await require('./hooks/app-shuffle-locals')(app, lando)); | ||
|
||
// If the app already is installed but we can't determine the builtAgainst, then set it to something bogus | ||
app.events.on('pre-start', async () => await require('./hooks/app-update-built-against-pre')(app, lando)); | ||
|
||
// If we don't have a builtAgainst already then we must be spinning up for the first time and its safe to set this | ||
app.events.on('post-start', async () => await require('./hooks/app-update-built-against-post')(app, lando)); | ||
|
||
// Add localhost info to our containers if they are up | ||
app.events.on('post-start', async () => await require('./hooks/app-find-localhosts')(app, lando)); | ||
|
||
// Check for docker compat warnings and surface them nicely as well | ||
app.events.on('post-start', async () => await require('./hooks/app-check-docker-compat')(app, lando)); | ||
|
||
// Reset app info on a stop, this helps prevent wrong/duplicate information being reported on a restart | ||
app.events.on('post-stop', async () => require('./utils/get-app-info-defaults')(app)); | ||
|
||
// Remove meta cache on destroy | ||
app.events.on('post-destroy', async () => await require('./hooks/app-purge-metadata-cache')(app, lando)); | ||
|
||
// remove v3 build locks | ||
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-v3-build-locks')(app, lando)); | ||
|
||
// remove v4 build locks | ||
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-v4-build-locks')(app, lando)); | ||
|
||
// remove compose cache | ||
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-compose-cache')(app, lando)); | ||
|
||
// remove tooling cache | ||
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-tooling-cache')(app, lando)); | ||
|
||
// process events | ||
if (!_.isEmpty(_.get(app, 'config.events', []))) { | ||
_.forEach(app.config.events, (cmds, event) => { | ||
app.events.on(event, 9999, async data => await require('./hooks/app-run-events')(app, lando, cmds, data, event)); | ||
}); | ||
} | ||
|
||
// LEGACY healthchecks | ||
if (_.get(lando, 'config.healthcheck', true) === 'legacy') { | ||
app.events.on('post-start', 2, async () => await require('./hooks/app-run-legacy-healthchecks')(app, lando)); | ||
} | ||
|
||
// LEGACY URL Scanner urls | ||
if (_.get(lando, 'config.scanner', true) === 'legacy') { | ||
app.events.on('post-start', 10, async () => await require('./hooks/app-run-legacy-scanner')(app, lando)); | ||
}; | ||
|
||
// REturn defualts | ||
return { | ||
env: { | ||
LANDO_APP_PROJECT: app.project, | ||
LANDO_APP_NAME: app.name, | ||
LANDO_APP_ROOT: app.root, | ||
LANDO_APP_ROOT_BIND: app.root, | ||
LANDO_APP_COMMON_NAME: _.truncate(app.project, {length: 64}), | ||
LANDO_LOAD_KEYS: getKeys(_.get(app, 'config.keys')), | ||
BITNAMI_DEBUG: 'true', | ||
}, | ||
labels: { | ||
'io.lando.src': app.configFiles.join(','), | ||
'io.lando.http-ports': '80,443', | ||
}, | ||
}; | ||
}; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.