-
-
Notifications
You must be signed in to change notification settings - Fork 291
no longer proxy to hydra from netlify #1154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Mic92
wants to merge
1
commit into
NixOS:master
Choose a base branch
from
Mic92:mirror-hydra
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Update development manual" | ||
on: | ||
repository_dispatch: | ||
workflow_dispatch: | ||
schedule: | ||
# Run weekly on Mondays at 3:31 AM UTC | ||
- cron: "31 3 * * 1" | ||
|
||
jobs: | ||
update-development-manual: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # Required to create releases and push changes | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v31 | ||
- name: Update development manual | ||
run: nix-shell --run update-development-manual | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
title: Update development manual | ||
labels: dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +0,0 @@ | ||
[[redirects]] | ||
from = "/manual/nix/unstable/*" | ||
to = "https://hydra.nixos.org/job/nix/master/manual/latest/download/1/manual/:splat" | ||
status = 200 | ||
force = true | ||
[redirects.headers] | ||
X-From = "nix.dev-Uogho3gi" | ||
|
||
[[redirects]] | ||
from = "/manual/nix/development/*" | ||
to = "https://hydra.nixos.org/job/nix/master/manual/latest/download/1/manual/:splat" | ||
status = 200 | ||
force = true | ||
[redirects.headers] | ||
X-From = "nix.dev-Uogho3gi" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": "2025.01.06", | ||
"sha256": "0000000000000000000000000000000000000000000000000000000000000000", | ||
"url": "https://github.com/NixOS/nix.dev/releases/download/development-manual-2025.01.06/manual.tar.xz", | ||
"updated": "2025-01-06 00:00:00 UTC" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
{ | ||
writeShellApplication, | ||
curl, | ||
jq, | ||
gh, | ||
coreutils, | ||
gnused, | ||
gnutar, | ||
gzip, | ||
git, | ||
}: | ||
# Update mechanism for development manual from Hydra, mirrored to GitHub releases | ||
writeShellApplication { | ||
name = "update-development-manual"; | ||
runtimeInputs = [ | ||
curl | ||
jq | ||
gh | ||
coreutils | ||
gnused | ||
gnutar | ||
gzip | ||
git | ||
]; | ||
text = '' | ||
set -euo pipefail | ||
|
||
echo >&2 "Downloading development manual from Hydra..." | ||
|
||
# Try multiple fallback URLs in case Hydra structure changes | ||
urls=( | ||
"https://hydra.nixos.org/job/nix/master/manual/latest/download/1/manual.tar.xz" | ||
"https://hydra.nixos.org/job/nix/master/build.x86_64-linux/latest/download/2/nix-*-x86_64-linux/share/doc/nix/manual" | ||
) | ||
|
||
tmp=$(mktemp -d) | ||
trap 'rm -rf "$tmp"' EXIT | ||
|
||
downloaded=false | ||
for url in "''${urls[@]}"; do | ||
echo >&2 "Trying to download from: $url" | ||
if curl -f -L -s "$url" -o "$tmp/manual.tar.xz"; then | ||
echo >&2 "Successfully downloaded from: $url" | ||
downloaded=true | ||
break | ||
fi | ||
done | ||
|
||
if [ "$downloaded" = false ]; then | ||
echo >&2 "Failed to download manual from any URL" | ||
exit 1 | ||
fi | ||
|
||
# Verify we got a valid archive | ||
if ! tar -tf "$tmp/manual.tar.xz" > /dev/null 2>&1; then | ||
echo >&2 "Downloaded file is not a valid tar archive" | ||
exit 1 | ||
fi | ||
|
||
# Calculate hash for comparison | ||
current_hash=$(sha256sum "$tmp/manual.tar.xz" | cut -d' ' -f1) | ||
|
||
# Check existing version file | ||
if [ -f "nix/development-manual.json" ]; then | ||
existing_hash=$(jq -r '.sha256' nix/development-manual.json) | ||
if [ "$existing_hash" = "$current_hash" ]; then | ||
echo >&2 "Manual with same content already exists" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully the manual actually doesn't change that often. So we don't always need to update this. |
||
exit 0 | ||
fi | ||
fi | ||
|
||
# Use date-based versioning for stability | ||
# Format: YYYY.MM.DD (with optional .N for multiple updates same day) | ||
base_version=$(date +%Y.%m.%d) | ||
|
||
# Check if this version already exists and increment if needed | ||
version="$base_version" | ||
counter=1 | ||
while gh release view "development-manual-$version" >/dev/null 2>&1; do | ||
version="$base_version.$counter" | ||
counter=$((counter + 1)) | ||
done | ||
|
||
echo >&2 "Creating new version: $version" | ||
|
||
current_time=$(date -u +"%Y-%m-%d %H:%M:%S UTC") | ||
|
||
# Create new versioned release | ||
release_tag="development-manual-$version" | ||
gh release create "$release_tag" "$tmp/manual.tar.xz" \ | ||
--title "Development Manual $version" \ | ||
--notes "Nix development manual from master branch ($current_time) | ||
|
||
Hash: $current_hash" \ | ||
--prerelease | ||
|
||
# Update the version file in the repository | ||
jq -n \ | ||
--arg version "$version" \ | ||
--arg sha256 "$current_hash" \ | ||
--arg url "https://github.com/NixOS/nix.dev/releases/download/$release_tag/manual.tar.xz" \ | ||
--arg updated "$current_time" \ | ||
'{ | ||
version: $version, | ||
sha256: $sha256, | ||
url: $url, | ||
updated: $updated | ||
}' > nix/development-manual.json | ||
|
||
echo >&2 "Development manual updated successfully!" | ||
echo >&2 "Version: $version" | ||
echo >&2 "Hash: $current_hash" | ||
echo >&2 "Updated: nix/development-manual.json" | ||
''; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be updated. Once we have the green light.