Skip to content

Commit c7bf5dc

Browse files
authored
Small maintenance (#13)
1 parent d57b028 commit c7bf5dc

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
packages: write
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1616

1717
- name: Setup Spack
1818
uses: spack/setup-spack@5ab3c91bdefffffad9a7e45d1d156146afebb3a7
@@ -29,7 +29,10 @@ jobs:
2929
make -Orecurse -j $(($(nproc) + 1)) SPACK_INSTALL_FLAGS=--no-check-signature
3030
3131
- name: Push packages and update index
32+
env:
33+
GITHUB_USER: ${{ github.actor }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235
run: |
33-
spack mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" github-actions-buildcache
36+
spack mirror set --push --oci-username-variable GITHUB_USER --oci-password-variable GITHUB_TOKEN github-actions-buildcache
3437
spack -e . buildcache push -j $(($(nproc) + 1)) --base-image ubuntu:20.04 --update-index github-actions-buildcache
3538
if: ${{ !cancelled() }}

.github/workflows/update-index.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
packages: write
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1616

1717
- name: Setup Spack
1818
uses: spack/setup-spack@5ab3c91bdefffffad9a7e45d1d156146afebb3a7

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
run: spack -e . install --no-check-signature
5656

5757
- name: Run
58-
run: ./my_view/bin/python -c 'print("hello world")'
58+
run: ./my_view/bin/python3 -c 'print("hello world")'
5959
```
6060
6161
## Caching your own binaries
@@ -71,7 +71,13 @@ If you want to cache your own binaries too, there are three steps to take:
7171
root: /opt/spack
7272
padded_length: 128
7373
mirrors:
74-
local-buildcache: oci://ghcr.io/<username>/spack-buildcache
74+
local-buildcache:
75+
url: oci://ghcr.io/<username>/spack-buildcache
76+
signed: false
77+
access_pair:
78+
id_variable: GITHUB_USER
79+
secret_variable: GITHUB_TOKEN
80+
7581
```
7682

7783
2. Configure the permissions for `GITHUB_TOKEN`:
@@ -92,9 +98,10 @@ If you want to cache your own binaries too, there are three steps to take:
9298
example:
9399
steps:
94100
- name: Push packages and update index
95-
run: |
96-
spack -e . mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
97-
spack -e . buildcache push --base-image ubuntu:22.04 --unsigned --update-index local-buildcache
101+
env:
102+
GITHUB_USER: ${{ github.actor }}
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache
98105
if: ${{ !cancelled() }}
99106
```
100107
NOTE: Make sure to add `if: ${{ !cancelled() }}`, so that binaries for successfully
@@ -104,30 +111,28 @@ If you want to cache your own binaries too, there are three steps to take:
104111

105112
When your local buildcache is stored in a private GitHub package,
106113
you need to specify the OCI credentials already *before* `spack concretize`.
107-
This is because Spack needs to fetch the buildcache index. Also, remember to
108-
remove the `--push` flag from `spack mirror set`, since fetching needs
109-
credentials too:
114+
This is because Spack needs to fetch the buildcache index.
110115

111116
```yaml
117+
env:
118+
GITHUB_USER: ${{ github.actor }}
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
112121
jobs:
113122
example-private:
114123
steps:
115-
- name: Login
116-
run: spack -e . mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
117-
118124
- name: Concretize
119125
run: spack -e . concretize
120126
121127
- name: Install
122128
run: spack -e . install --no-check-signature
123129
124130
- name: Push packages and update index
125-
run: spack -e . buildcache push --base-image ubuntu:22.04 --unsigned --update-index local-buildcache
131+
run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache
126132
```
127133

128-
From a security perspective, notice that the `GITHUB_TOKEN` is exposed to every
129-
subsequent job step. (This is no different from `docker login`, which also likes
130-
to store credentials in the home directory.)
134+
From a security perspective, do note that the `GITHUB_TOKEN` is exposed to every
135+
job step.
131136

132137
## Contributing
133138

0 commit comments

Comments
 (0)