Skip to content

Commit

Permalink
Do not pass credentials to file_fetcher/updater
Browse files Browse the repository at this point in the history
These are now available in the proxy
  • Loading branch information
Jurre Stender committed Aug 11, 2021
1 parent 2fd6ad1 commit 8ba8780
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type JobDetails = {
}[]
id: string
'package-manager': PackageManager
credentials: Credential[] // TODO: Remove these once the proxy is set up
}

export type Credential = {
Expand Down
1 change: 0 additions & 1 deletion src/file-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export type FetchedFiles = {

export type FileFetcherInput = {
job: JobDetails
credentials: Credential[]
}

export type DependencyFile = {
Expand Down
14 changes: 4 additions & 10 deletions src/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as core from '@actions/core'
import Docker, {Container} from 'dockerode'
import path from 'path'
import fs from 'fs'
import {Credential, JobDetails, APIClient} from './api-client'
import {JobDetails, APIClient} from './api-client'
import {ContainerService} from './container-service'
import {base64DecodeDependencyFile} from './utils'
import {DependencyFile, FetchedFiles, FileUpdaterInput} from './file-types'
Expand Down Expand Up @@ -36,12 +36,10 @@ export class Updater {
try {
const details = await this.apiClient.getJobDetails()
const credentials = await this.apiClient.getCredentials()
// TODO: once the proxy is set up, remove credentials from the job details
details.credentials = credentials

await this.proxy.run(details, credentials)

const files = await this.runFileFetcher(details, credentials)
const files = await this.runFileFetcher(details)
if (!files) {
core.error(`failed during fetch, skipping updater`)
// TODO: report job runner_error?
Expand All @@ -59,18 +57,14 @@ export class Updater {
}

private async runFileFetcher(
details: JobDetails,
credentials: Credential[]
details: JobDetails
): Promise<void | FetchedFiles> {
const container = await this.createContainer('fetch_files')
await ContainerService.storeInput(
JOB_INPUT_FILENAME,
JOB_INPUT_PATH,
container,
{
job: details,
credentials
}
{job: details}
)
await ContainerService.storeCert(
CA_CERT_FILENAME,
Expand Down

0 comments on commit 8ba8780

Please sign in to comment.