"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.currentDeployedVersion = void 0;
const helpers_1 = require("../helpers");
exports.currentDeployedVersion = (component, namespace) => {
    const { stdout: rawManifest } = helpers_1.exec(`kubectl get pod -l component=${component} -n ${namespace} -o json`, true);
    const podManifest = JSON.parse(rawManifest);
    if (!podManifest || !podManifest.items.length) {
        throw new Error(`Did not find any pod in ns ${namespace} w/ component ${component}`);
    }
    const tag = podManifest.items[0].metadata.labels["app.kubernetes.io/version"];
    if (!tag) {
        throw new Error(`Did not find any pod in ns ${namespace} w/ component ${component}`);
    }
    console.log(tag);
    return tag;
};
//# sourceMappingURL=currentDeployedVersion.js.map