From 7439f8b4676e6b66b67287ce5debbb9b42ae1e5e Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Wed, 28 Apr 2021 00:34:26 +0200 Subject: [PATCH] Remove os limitation Signed-off-by: CrazyMax --- .github/docker-login.png | Bin 5134 -> 4404 bytes .github/workflows/ci.yml | 18 ++++++++++++++++++ README.md | 10 ---------- __tests__/main.test.ts | 11 ----------- dist/index.js | 26 +++++++++++--------------- src/docker.ts | 18 +++++++++--------- src/main.ts | 9 ++------- 7 files changed, 40 insertions(+), 52 deletions(-) diff --git a/.github/docker-login.png b/.github/docker-login.png index b6ef96381d555d036a2330619af973f4ef0d5328..02594b90ea5b75259a585b77dde84d9ae0f620c3 100644 GIT binary patch literal 4404 zcmZ8l2T+qs*9HLvj5Lv&5Q+j)r6~y=0i{b52%S*m0!k!=CROS1s&u3VsR{^Eq)9-^ zD^f#IilHR*Dkunw^5gx!``>^5nKNh4?w);iXP}=dEqZ{WKc^IjvsLtu$)H0=_ zqNbeK+w?RidLL@geKO#B%fMWl0m8z;E0~a)#{g09B~B_pSe#OQ^o3X$gshy9EDR9Q zggfdCNFRkedGJ4;Iye(ixJgV^hz>3_ulJdoQ)-@m=*e0i4qi8ZH9>1$K@NvPtCC~H zA50%X2unh!l~ZbrerOCLq|Lvf&HCA-a!Ip)!(?wm6fV>Xml~6h8Y3;rl0uy1P>V_- z7M8tw(@QLjPD&HR9W#h#1V_fDI0!0hvaoVMt#CdJ5FG~1<_i#(s)i{2P#=_|yS_;b zF4adu79kCg^z3h5up{Y}9D_q0mL<)~B_u&%Ddm#mD&k}nvCs<0&^wV5QVOw6;ZBS` z(#ooYR7GraIyr`kl{K%96H+}mBF^6-N}S(R0dhqeIEF(+P0@iacK!5-bRejC+rLDV@_hg`X%*{*3y=G- z+%~kV@n{%xST0I^Sq^I(y7G4qPuVqlzw_%FNp!8P3I0U4FqUFZJ45RdDLU84yE$_1 z{lb-Mw3f^Y9aDx)M9hAtZ$|`H(8(KfZ?FGC7{REo_2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6B>sAv4O zRV!gwY%Nk{mkh5qQMG**VLAB*LgSTc`qXi588HbE{ctYLn-VR zA#}7P1`PsP!bCdc#v+=V~esl~*B9YlOb`2h|hqXMZ>E?5cG> zqiQXt{b^zC^4CU|=Ps(qH+ce?2loEH*;WGe)SMigp@MDIbVeq8T>dH%B=T9A@~ r+3KF}s_qnSSmuAxR{u%+0o^6}o3uuW;*b9R=L6j_Fx5xvI!6Bwje7Q` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 815134b..ad86ddd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,24 @@ on: - 'releases/v*' jobs: + stop-docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Stop docker + run: | + sudo systemctl stop docker + - + name: Login to GitHub Container Registry + uses: ./ + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + dind: runs-on: ubuntu-latest env: diff --git a/README.md b/README.md index 25ef287..542e4bb 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,6 @@ GitHub Action to login against a Docker registry. -> :bulb: See also: -> * [setup-buildx](https://github.com/docker/setup-buildx-action) action -> * [setup-qemu](https://github.com/docker/setup-qemu-action) action -> * [build-push](https://github.com/docker/build-push-action) action - ![Screenshot](.github/docker-login.png) ___ @@ -32,7 +27,6 @@ ___ * [Customizing](#customizing) * [inputs](#inputs) * [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot) -* [Limitation](#limitation) ## Usage @@ -433,7 +427,3 @@ updates: schedule: interval: "daily" ``` - -## Limitation - -This action is only available for Linux [virtual environments](https://help.github.com/en/articles/virtual-environments-for-github-actions#supported-virtual-environments-and-hardware-resources). diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 7c8782e..7700ae7 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -6,17 +6,6 @@ import * as stateHelper from '../src/state-helper'; import * as core from '@actions/core'; -test('errors when not run on linux platform', async () => { - const platSpy = jest.spyOn(osm, 'platform'); - platSpy.mockImplementation(() => 'netbsd'); - - const coreSpy: jest.SpyInstance = jest.spyOn(core, 'setFailed'); - - await run(); - - expect(coreSpy).toHaveBeenCalledWith('Only supported on linux platform'); -}); - test('errors without username and password', async () => { const platSpy = jest.spyOn(osm, 'platform'); platSpy.mockImplementation(() => 'linux'); diff --git a/dist/index.js b/dist/index.js index 24f6bdd..6a66bc3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -497,18 +497,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = void 0; -const os = __importStar(__webpack_require__(87)); const core = __importStar(__webpack_require__(186)); -const context_1 = __webpack_require__(842); +const context = __importStar(__webpack_require__(842)); const docker = __importStar(__webpack_require__(758)); const stateHelper = __importStar(__webpack_require__(647)); function run() { return __awaiter(this, void 0, void 0, function* () { try { - if (os.platform() !== 'linux') { - throw new Error('Only supported on linux platform'); - } - const { registry, username, password, logout } = context_1.getInputs(); + const { registry, username, password, logout } = context.getInputs(); stateHelper.setRegistry(registry); stateHelper.setLogout(logout); yield docker.login(registry, username, password); @@ -3069,16 +3065,16 @@ function loginStandard(registry, username, password) { loginArgs.push('--username', username); loginArgs.push(registry); if (registry) { - core.info(`🔑 Logging into ${registry}...`); + core.info(`Logging into ${registry}...`); } else { - core.info(`🔑 Logging into Docker Hub...`); + core.info(`Logging into Docker Hub...`); } yield execm.exec('docker', loginArgs, true, password).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } - core.info('🎉 Login Succeeded!'); + core.info(`Login Succeeded!`); }); }); } @@ -3090,26 +3086,26 @@ function loginECR(registry, username, password) { const region = yield aws.getRegion(registry); const accountIDs = yield aws.getAccountIDs(registry); if (yield aws.isPubECR(registry)) { - core.info(`💡 AWS Public ECR detected with ${region} region`); + core.info(`AWS Public ECR detected with ${region} region`); } else { - core.info(`💡 AWS ECR detected with ${region} region`); + core.info(`AWS ECR detected with ${region} region`); } process.env.AWS_ACCESS_KEY_ID = username || process.env.AWS_ACCESS_KEY_ID; process.env.AWS_SECRET_ACCESS_KEY = password || process.env.AWS_SECRET_ACCESS_KEY; - core.info(`⬇️ Retrieving docker login command through AWS CLI ${cliVersion} (${cliPath})...`); + core.info(`Retrieving docker login command through AWS CLI ${cliVersion} (${cliPath})...`); const loginCmds = yield aws.getDockerLoginCmds(cliVersion, registry, region, accountIDs); - core.info(`🔑 Logging into ${registry}...`); + core.info(`Logging into ${registry}...`); loginCmds.forEach((loginCmd, index) => { execm.exec(loginCmd, [], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } if (loginCmds.length > 1) { - core.info(`🎉 Login Succeeded! (${index}/${loginCmds.length})`); + core.info(`Login Succeeded! (${index}/${loginCmds.length})`); } else { - core.info('🎉 Login Succeeded!'); + core.info('Login Succeeded!'); } }); }); diff --git a/src/docker.ts b/src/docker.ts index 19aeb63..9924eb2 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -28,15 +28,15 @@ export async function loginStandard(registry: string, username: string, password loginArgs.push(registry); if (registry) { - core.info(`🔑 Logging into ${registry}...`); + core.info(`Logging into ${registry}...`); } else { - core.info(`🔑 Logging into Docker Hub...`); + core.info(`Logging into Docker Hub...`); } await execm.exec('docker', loginArgs, true, password).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } - core.info('🎉 Login Succeeded!'); + core.info(`Login Succeeded!`); }); } @@ -47,27 +47,27 @@ export async function loginECR(registry: string, username: string, password: str const accountIDs = await aws.getAccountIDs(registry); if (await aws.isPubECR(registry)) { - core.info(`💡 AWS Public ECR detected with ${region} region`); + core.info(`AWS Public ECR detected with ${region} region`); } else { - core.info(`💡 AWS ECR detected with ${region} region`); + core.info(`AWS ECR detected with ${region} region`); } process.env.AWS_ACCESS_KEY_ID = username || process.env.AWS_ACCESS_KEY_ID; process.env.AWS_SECRET_ACCESS_KEY = password || process.env.AWS_SECRET_ACCESS_KEY; - core.info(`⬇️ Retrieving docker login command through AWS CLI ${cliVersion} (${cliPath})...`); + core.info(`Retrieving docker login command through AWS CLI ${cliVersion} (${cliPath})...`); const loginCmds = await aws.getDockerLoginCmds(cliVersion, registry, region, accountIDs); - core.info(`🔑 Logging into ${registry}...`); + core.info(`Logging into ${registry}...`); loginCmds.forEach((loginCmd, index) => { execm.exec(loginCmd, [], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } if (loginCmds.length > 1) { - core.info(`🎉 Login Succeeded! (${index}/${loginCmds.length})`); + core.info(`Login Succeeded! (${index}/${loginCmds.length})`); } else { - core.info('🎉 Login Succeeded!'); + core.info('Login Succeeded!'); } }); }); diff --git a/src/main.ts b/src/main.ts index 06ff25c..f15082e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,16 +1,11 @@ -import * as os from 'os'; import * as core from '@actions/core'; -import {getInputs, Inputs} from './context'; +import * as context from './context'; import * as docker from './docker'; import * as stateHelper from './state-helper'; export async function run(): Promise { try { - if (os.platform() !== 'linux') { - throw new Error('Only supported on linux platform'); - } - - const {registry, username, password, logout} = getInputs(); + const {registry, username, password, logout} = context.getInputs(); stateHelper.setRegistry(registry); stateHelper.setLogout(logout); await docker.login(registry, username, password);