Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const repoCommitId = {
'azure-sdk-for-java': '307df24267304fbf3947025bef7eaf9698410de8',
'azure-sdk-for-python': '53f66170cc47739204cedfe0a46989290c047c98',
'azure-sdk-for-go': '241bdb849ce431e1a5e398a5649cde93149ee374',
'azure-sdk-for-net': 'e9db0733a642d50c34101339f74fdc487599d824',
'azure-sdk-for-net': 'e9db0733a642d50c34101339f74fdc487599d824'
};

const defaultImageName = 'sdkgeneration.azurecr.io/sdk-generation:v1.0';
Expand All @@ -25,36 +25,36 @@ async function prepareRepo(currentPath: string, repoName: string) {
if (!existsSync(path.join(tmpFolder, repoName))) {
execSync(`git clone https://github.com/Azure/${repoName}.git`, {
cwd: tmpFolder,
stdio: 'inherit',
stdio: 'inherit'
});
}
execSync(`git restore --staged . && git restore . && git checkout . && git clean -fd`, {
cwd: path.join(tmpFolder, repoName),
stdio: 'inherit',
stdio: 'inherit'
});

if (
!!repoCommitId[repoName] &&
execSync(`git rev-parse HEAD`, {
encoding: 'utf-8',
cwd: path.join(tmpFolder, repoName),
cwd: path.join(tmpFolder, repoName)
}).trim() !== repoCommitId[repoName]
) {
execSync(`git checkout ${repoCommitId[repoName]}`, {
cwd: path.join(tmpFolder, repoName),
stdio: 'inherit',
stdio: 'inherit'
});
}

if (
execSync(`git rev-parse --abbrev-ref HEAD`, {
encoding: 'utf-8',
cwd: path.join(tmpFolder, repoName),
cwd: path.join(tmpFolder, repoName)
}).trim() !== integrationBranch
) {
execSync(`git switch -c ${integrationBranch}`, {
cwd: path.join(tmpFolder, repoName),
stdio: 'inherit',
stdio: 'inherit'
});
}
}
Expand All @@ -68,19 +68,19 @@ async function runDocker(currentPath: string, sdkRepoName: string, dockerImage:
sdkRepoName
)}:/sdk-repo ${dockerImage} --readme=specification/agrifood/resource-manager/readme.md`,
{
stdio: 'inherit',
stdio: 'inherit'
}
);
}

async function buildDockImage(rushCwd: string, dockerCwd: string) {
execSync(`rushx pack`, {
cwd: rushCwd,
stdio: 'inherit',
stdio: 'inherit'
});
execSync(`docker build -t ${defaultImageName} .`, {
cwd: dockerCwd,
stdio: 'inherit',
stdio: 'inherit'
});
}

Expand All @@ -104,7 +104,7 @@ export async function main(options: any) {

const optionDefinitions = [
{ name: 'docker-image', type: String },
{ name: 'sdk-repo', type: String },
{ name: 'sdk-repo', type: String }
];
const options = commandLineArgs(optionDefinitions);

Expand Down