[#76] Depgraph should work w/o Docker registry
This commit is contained in:
parent
c1fdf4399b
commit
7e0fec7160
12
doc/build.md
12
doc/build.md
|
@ -93,7 +93,7 @@ Options:
|
||||||
--manual operate explicitly on manual artifacts
|
--manual operate explicitly on manual artifacts
|
||||||
--hold-manual prefer local versions of manual artifacts
|
--hold-manual prefer local versions of manual artifacts
|
||||||
--all do not skip unneeded intermediate artifacts
|
--all do not skip unneeded intermediate artifacts
|
||||||
--local-only do not fetch artifacts from remote registries
|
--registry interface with remote registry for caching
|
||||||
--publish publish artifacts to remote registries
|
--publish publish artifacts to remote registries
|
||||||
--yes execute plan without confirmation
|
--yes execute plan without confirmation
|
||||||
-h, --help display help for command
|
-h, --help display help for command
|
||||||
|
@ -105,10 +105,12 @@ those artifacts. Depgraph is like Terraform in that it will compute a
|
||||||
plan and then ask you to confirm before proceeding.
|
plan and then ask you to confirm before proceeding.
|
||||||
|
|
||||||
By default Depgraph will generate artifacts locally only, although it
|
By default Depgraph will generate artifacts locally only, although it
|
||||||
will download remote artifacts if appropriate versions exist in the
|
can be instructed to also interact with a remote registry if you've
|
||||||
registry. Pass `--publish` to also cache generated artifacts in the
|
set up the infrastructure appropriately. Pass `--registry` to enable
|
||||||
remote registries. Of course `--publish` is required to build
|
this mode, in which case Depgraph will download remote artifacts when
|
||||||
`deploy:live`.
|
appropriate versions exist in the registry. Pass `--publish` along
|
||||||
|
with `--registry` to also cache generated artifacts in the remote
|
||||||
|
registries. Of course `--publish` is required to build `deploy:live`.
|
||||||
|
|
||||||
For dealing with `image:ubuntu` specifically, you probably just want
|
For dealing with `image:ubuntu` specifically, you probably just want
|
||||||
to fetch Riju's version (available in a public ECR repository) using
|
to fetch Riju's version (available in a public ECR repository) using
|
||||||
|
|
|
@ -69,7 +69,6 @@ function getInformationalDependencies() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getImageArtifact({ tag, isBaseImage, isLangImage }) {
|
async function getImageArtifact({ tag, isBaseImage, isLangImage }) {
|
||||||
const DOCKER_REPO = getDockerRepo();
|
|
||||||
const name = isLangImage ? "lang" : tag;
|
const name = isLangImage ? "lang" : tag;
|
||||||
let baseImageTags = [];
|
let baseImageTags = [];
|
||||||
let dependencies = [];
|
let dependencies = [];
|
||||||
|
@ -100,6 +99,7 @@ async function getImageArtifact({ tag, isBaseImage, isLangImage }) {
|
||||||
return await getLocalImageLabel(`riju:${tag}`, "riju.image-hash");
|
return await getLocalImageLabel(`riju:${tag}`, "riju.image-hash");
|
||||||
},
|
},
|
||||||
getPublishedHash: async ({ dockerRepoTags }) => {
|
getPublishedHash: async ({ dockerRepoTags }) => {
|
||||||
|
const DOCKER_REPO = getDockerRepo();
|
||||||
if (!dockerRepoTags.includes(tag)) {
|
if (!dockerRepoTags.includes(tag)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,7 @@ async function getImageArtifact({ tag, isBaseImage, isLangImage }) {
|
||||||
publishToRegistry: async () => {
|
publishToRegistry: async () => {
|
||||||
await runCommand(`make push I=${tag}`);
|
await runCommand(`make push I=${tag}`);
|
||||||
},
|
},
|
||||||
|
syncCommand: isBaseImage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ async function getDepGraph() {
|
||||||
artifacts.push(
|
artifacts.push(
|
||||||
await getImageArtifact({
|
await getImageArtifact({
|
||||||
tag: "ubuntu",
|
tag: "ubuntu",
|
||||||
isBaseImage: true,
|
isBaseImage: "make sync-ubuntu",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
artifacts.push(await getImageArtifact({ tag: "packaging" }));
|
artifacts.push(await getImageArtifact({ tag: "packaging" }));
|
||||||
|
@ -388,7 +389,7 @@ async function executeDepGraph({
|
||||||
manual,
|
manual,
|
||||||
holdManual,
|
holdManual,
|
||||||
all,
|
all,
|
||||||
localOnly,
|
registry,
|
||||||
publish,
|
publish,
|
||||||
yes,
|
yes,
|
||||||
targets,
|
targets,
|
||||||
|
@ -412,7 +413,7 @@ async function executeDepGraph({
|
||||||
)) {
|
)) {
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
localOnly &&
|
!registry &&
|
||||||
["getPublishedHash", "retrieveFromRegistry"].includes(method)
|
["getPublishedHash", "retrieveFromRegistry"].includes(method)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -442,16 +443,16 @@ async function executeDepGraph({
|
||||||
promises.desired[target] = Promise.resolve(null);
|
promises.desired[target] = Promise.resolve(null);
|
||||||
} else {
|
} else {
|
||||||
promises.local[target] = artifacts[target].getLocalHash(info);
|
promises.local[target] = artifacts[target].getLocalHash(info);
|
||||||
promises.published[target] = localOnly
|
promises.published[target] = registry
|
||||||
? Promise.resolve(null)
|
? artifacts[target].getPublishedHash(info)
|
||||||
: artifacts[target].getPublishedHash(info);
|
: Promise.resolve(null);
|
||||||
promises.desired[target] = (async () => {
|
promises.desired[target] = (async () => {
|
||||||
const dependencyHashes = {};
|
const dependencyHashes = {};
|
||||||
for (const dependency of artifacts[target].dependencies) {
|
for (const dependency of artifacts[target].dependencies) {
|
||||||
dependencyHashes[dependency] = await promises.desired[dependency];
|
dependencyHashes[dependency] = await promises.desired[dependency];
|
||||||
if (!dependencyHashes[dependency]) {
|
if (!dependencyHashes[dependency]) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`manual dependency must be built explicitly: dep ${dependency} --manual [--publish]`
|
`manual artifact must be retrieved explicitly: run '${artifacts[dependency].syncCommand}' (or dep '${dependency} --manual' to update)`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,7 +471,7 @@ async function executeDepGraph({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`manual artifact must be built explicitly: dep ${target} --manual [--publish]`
|
`manual artifact must be retrieved explicitly: run '${artifacts[target].syncCommand}' (or dep '${target} --manual' to update)`
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
@ -656,14 +657,11 @@ async function main() {
|
||||||
program.option("--manual", "operate explicitly on manual artifacts");
|
program.option("--manual", "operate explicitly on manual artifacts");
|
||||||
program.option("--hold-manual", "prefer local versions of manual artifacts");
|
program.option("--hold-manual", "prefer local versions of manual artifacts");
|
||||||
program.option("--all", "do not skip unneeded intermediate artifacts");
|
program.option("--all", "do not skip unneeded intermediate artifacts");
|
||||||
program.option(
|
program.option("--registry", "interface with remote registry for caching");
|
||||||
"--local-only",
|
|
||||||
"do not fetch artifacts from remote registries"
|
|
||||||
);
|
|
||||||
program.option("--publish", "publish artifacts to remote registries");
|
program.option("--publish", "publish artifacts to remote registries");
|
||||||
program.option("--yes", "execute plan without confirmation");
|
program.option("--yes", "execute plan without confirmation");
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
const { list, manual, holdManual, all, localOnly, publish, yes } =
|
const { list, manual, holdManual, all, registry, publish, yes } =
|
||||||
program.opts();
|
program.opts();
|
||||||
const depgraph = await getDepGraph();
|
const depgraph = await getDepGraph();
|
||||||
if (list) {
|
if (list) {
|
||||||
|
@ -683,7 +681,7 @@ async function main() {
|
||||||
manual,
|
manual,
|
||||||
holdManual,
|
holdManual,
|
||||||
all,
|
all,
|
||||||
localOnly,
|
registry,
|
||||||
publish,
|
publish,
|
||||||
yes,
|
yes,
|
||||||
targets: program.args,
|
targets: program.args,
|
||||||
|
|
Loading…
Reference in New Issue