WIP
This commit is contained in:
+7
-12
@@ -7,7 +7,7 @@ import path from "path";
|
||||
import { generateHasDir, generateMD5, jjDecrypt, jjEncrypt } from "@helpers/cryptoUtils";
|
||||
import { saveFileIfItChanged } from "@helpers/saveFileIfItChanged";
|
||||
import * as YAML from "js-yaml";
|
||||
import { subRepositoryClean } from "@helpers/gitSubRepoUtils";
|
||||
import { subRepositoryClean, subRepositoryPull, subRepositoryPushChanges } from "@helpers/gitSubRepoUtils";
|
||||
|
||||
const logger = makeJJlogger({
|
||||
filename: 'jj/cli/secrets.ts'
|
||||
@@ -119,7 +119,10 @@ const setSecretFile = async ({
|
||||
const commitSecretMeta = async () => {
|
||||
|
||||
const metadataRepoFolderRelative = getJJConfigByKeyChain(`metadataRepo.path`)
|
||||
const metadataRepoBranch = getJJConfigByKeyChain(`metadataRepo.branch`)
|
||||
await subRepositoryClean(metadataRepoFolderRelative)
|
||||
await subRepositoryPull(metadataRepoFolderRelative, metadataRepoBranch)
|
||||
|
||||
|
||||
logger.log(`commitSecretMeta for ${process.env.JJ_CLI_SELECTED_COMMIT} start`)
|
||||
|
||||
@@ -163,19 +166,11 @@ const commitSecretMeta = async () => {
|
||||
}
|
||||
_.set(currentMetadataSecretsObj, `secrets.${environmentKey}.${secretFileNameWithoutExtension}`, encryptedSecretFileHash)
|
||||
await fs.writeFile(secretsMetadataPath, YAML.dump(currentMetadataSecretsObj, {}), "utf8")
|
||||
|
||||
// const secretHash = hash7((await generateDirectoryeHash(encryptedSecretFilePath)).hash)
|
||||
// let secretName = jsonSourceFormatEncryptedSecret.split(".json")[0]
|
||||
// const configSecretName = `${secretName}_${secretHash}`
|
||||
// const configFile = `${environmentSecretsFolder}/${configSecretName}.json`
|
||||
|
||||
// if (!fs.existsSync(configFile)) {
|
||||
// fs.copyFileSync(encryptedSecretFilePath, configFile)
|
||||
// }
|
||||
|
||||
// _.set(currentCommitMetadataSecrets, `secrets.${environmentToPush}.${secretName}`, secretHash)
|
||||
}
|
||||
}
|
||||
await subRepositoryPushChanges(metadataRepoFolderRelative, metadataRepoBranch, `${process.env.JJ_CLI_SELECTED_COMMIT} ${process.env.JJ_GIT_USER_EMAIL} 'jj secrets commitSecretMeta'`)
|
||||
|
||||
|
||||
|
||||
logger.success(`commitSecretMeta for ${process.env.JJ_CLI_SELECTED_COMMIT} done`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user