mirror of
https://github.com/redhat-actions/podman-login.git
synced 2025-02-23 10:31:21 +01:00
Set env var REGISTRY_AUTH_FILE to work with buildah (#6)
* Set env var REGISTRY_AUTH_FILE to work with buildah Signed-off-by: divyansh42 <diagrawa@redhat.com> * Add info level message Signed-off-by: divyansh42 <diagrawa@redhat.com> * Resolve reviews Signed-off-by: divyansh42 <diagrawa@redhat.com> * Reslve reviews Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
4bf4190336
commit
d968d572fb
7 changed files with 46 additions and 10 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -2,6 +2,8 @@ name: CI checks
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *' # every day at midnight
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
|
31
.github/workflows/example.yml
vendored
31
.github/workflows/example.yml
vendored
|
@ -1,16 +1,19 @@
|
||||||
name: Test Login
|
name: Test Login and Pull
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *' # every day at midnight
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_USER: diagrawa
|
IMAGE_PATH: quay.io/redhat-github-actions/petclinic-private:latest
|
||||||
|
REGISTRY_USER: redhat-github-actions+redhat_actions_ci_puller
|
||||||
IMAGE_REGISTRY: quay.io
|
IMAGE_REGISTRY: quay.io
|
||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
login:
|
podman-pull:
|
||||||
name: Log in to registry
|
name: Log in and pull image with Podman
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
@ -22,3 +25,23 @@ jobs:
|
||||||
username: ${{ env.REGISTRY_USER }}
|
username: ${{ env.REGISTRY_USER }}
|
||||||
password: ${{ env.REGISTRY_PASSWORD }}
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
registry: ${{ env.IMAGE_REGISTRY }}
|
registry: ${{ env.IMAGE_REGISTRY }}
|
||||||
|
|
||||||
|
- name: Pull image with Podman
|
||||||
|
run: podman pull ${{ env.IMAGE_PATH }}
|
||||||
|
|
||||||
|
buildah-pull:
|
||||||
|
name: Log in and pull image with Buildah
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Log in to quay.io
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
username: ${{ env.REGISTRY_USER }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
registry: ${{ env.IMAGE_REGISTRY }}
|
||||||
|
|
||||||
|
- name: Pull image with Buildah
|
||||||
|
run: buildah pull ${{ env.IMAGE_PATH }}
|
||||||
|
|
2
.github/workflows/link_check.yml
vendored
2
.github/workflows/link_check.yml
vendored
|
@ -6,6 +6,8 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *' # every day at midnight
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
markdown-link-check:
|
markdown-link-check:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# podman-login
|
# podman-login
|
||||||
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22CI+checks%22)
|
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22CI+checks%22)
|
||||||
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3ABuild)
|
[](https://github.com/redhat-actions/podman-login/actions/workflows/example.yml)
|
||||||
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22Link+checker%22)
|
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22Link+checker%22)
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as io from "@actions/io";
|
import * as io from "@actions/io";
|
||||||
import * as os from "os";
|
import * as os from "os";
|
||||||
|
import * as path from "path";
|
||||||
import { getInputs } from "./context";
|
import { getInputs } from "./context";
|
||||||
import { execute } from "./utils";
|
import { execute } from "./utils";
|
||||||
import * as stateHelper from "./state-helper";
|
import * as stateHelper from "./state-helper";
|
||||||
|
@ -44,6 +45,14 @@ async function run(): Promise<void> {
|
||||||
|
|
||||||
await execute(await getPodmanPath(), args);
|
await execute(await getPodmanPath(), args);
|
||||||
core.info(`✅ Successfully logged in to ${registry} as ${username}`);
|
core.info(`✅ Successfully logged in to ${registry} as ${username}`);
|
||||||
|
|
||||||
|
// Setting REGISTRY_AUTH_FILE environment variable as buildah needs
|
||||||
|
// this environment variable to point to registry auth file
|
||||||
|
const podmanAuthFilePath = path.join("/", "tmp", `podman-run-${process.getuid()}`,
|
||||||
|
"containers", "auth.json");
|
||||||
|
const REGISTRY_AUTH_ENVVAR = "REGISTRY_AUTH_FILE";
|
||||||
|
core.info(`Exporting ${REGISTRY_AUTH_ENVVAR}=${podmanAuthFilePath}`);
|
||||||
|
core.exportVariable(REGISTRY_AUTH_ENVVAR, podmanAuthFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function registryLogout(): Promise<void> {
|
async function registryLogout(): Promise<void> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue